简体   繁体   中英

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.

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, eg .prettierrc file to the root of your project and setting the printwidth, eg

{
  "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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM