0

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
}
5ocjal
  • 13
  • 5
  • That should work, as shown in [this playground](https://prettier.io/playground/#N4Igxg9gdgLgprEAuEMAWBLAzgOgEYCGANkTlnDAGpxERgYwCeAFAEwAM7ANAAQfsBKMhQBCEAK5QwcZuxwB2IeRgBhCCQwATOAHUIAJyKaxkzVmYx94uEooBlMMRlz2AFlswAsgSznWAgG4AHSgQLhAIAAcYDGgsZFACfX0IAHcABSSEeJRiVIJGePC8fQIwAGt7SLKMKABzZEtrcLQYAFsiHUx4LGrpO2yGDAA3BkZkcF8wkFryfRh00rq2gmQAM2JycIArLAAPEVKK+wI2uAAZWrh1zbgd-btauqI4AEVxCHgboi2Qav05hNCHgaNNIvpajAdFp0MgABzcP4pcg6UqRCbguBzYbXcIARw+8EWURyIB8AFooHA4NpNNN9HACRgGYsCMtVkgNj87iByG0MI0rDysE8Xu9PtdObdwjACHhoZpYUhWDLShgiE81G0VhMsQBWabicgAFTlOS5v2G1gAklBtLAHBDogBBO12Jgvb7kAC+3qAA). – Cameron Little Apr 12 '20 at 15:06
  • What's your configuration look like? – Cameron Little Apr 12 '20 at 15:06
  • Added my config in main post. – 5ocjal Apr 12 '20 at 15:12

1 Answers1

2

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.

Cameron Little
  • 3,487
  • 23
  • 35