Search code examples
visual-studio-codecode-formattingprettier

Prettier - custom config option


how to made prettier to format my code in the way lika on a picture?

code_format

Every time I save my code it is formatted to one line of code, but it's much more readable for me to keep it like on shared picture.

EDIT:

My .prettierrc:

{
  "singleQuote": true,
  "printWidth": 200,
  "semi": true,
  "bracketSpacing": true,
  "arrowParens": "always",
  "parser": "typescript",
  "useTabs": false,
  "tabWidth": 2
}

Solution

  • You'll have to reduce your printWidth in order to do this. The default of 80 will format like you want. Prettier intentionally limits its options to reduce customizability, which you can read about here.