Search code examples
javascriptvisual-studio-codeprettier

prettier convert multi line to single line in constructor function


I use prettier for formatting code. Recently I followed that sometimes it's pretty annoying. It's auto create multi line to single line in constructor function. How can I stop this behavior?

Before Save

Before Save

After Save

After Save


Solution

  • Looks like you are missing a , after the end of line in line 33.

    That's how prettier or any common formatter works, if you add a comma after a line that needs comma then it would come to the next line, else it will make it inline like yours.