mattsmith5
mattsmith5

Reputation: 1133

VSCode Prettier Keeps separating Condition statements into separate lines

How do I Stop Prettier VSCode Formatter from breaking up equal statements? The following condition statement is broken into two lines, when coding Angular.

if (
   productId ===
   productTest
){

It makes it difficult to read simple code.

Upvotes: 2

Views: 1100

Answers (1)

chrismclarke
chrismclarke

Reputation: 2105

Prettier doesn't by default break up equal statements, so either the statement exceeds the maximum print width, or you have another plugin that is somehow interfering.

You can increase the printwidth by adding a prettier configuration file, e.g. .prettierrc file to the root of your project and setting the printwidth, e.g.

{
  "printWidth": 100
}

You can see the full list of configuration file types and options at: https://prettier.io/docs/en/configuration.html
https://prettier.io/docs/en/options.html

Upvotes: 1

Related Questions