Published 6/26/2017
Prettier code formatting - no more code style wars!

Prettier, just do it!

JavaScript and TypeScript code formatting revolution.


  • JavaScript, including ES2017
  • JSX
  • Flow
  • TypeScript
  • CSS, LESS, and SCSS
  • JSON
  • GraphQL (also inline queries in javascript files)

Why I need it?

Prettier saves time!

Prettier can fix many issues your linter finds. Except of that, it will also do formatting of code by "human way".

It knows when to wrap lines if they exceed, and it knows how to wrap lines so your code will always looks nice!

Prettier stop all fights in you company! You just follow codestyle, given by prettier. Or you can contribute to this great project and propose some changes.


npm install --save prettier

Run through CLI:

prettier --write "./**/*.js"

If you need typescript support run:

prettier --parser typescript --write "./**/*.{ts,tsx}"

Although it's opinionated formatter, there is possibility to configure some specific aspects like line width, use " instead of ', etc. See prettier configuration.

VS Code integration

Install Prettier Plugin for VS Code and follow their steps.

Don't forget to configure formatting on save "editor.formatOnSave": true. Prettier will be used automatically.

Is it worth it?


I started using prettier not only in team in company, where it solves all discussions about code style (prettier just works fine enough), but also on personal side projects where it really helps me to keep code nice and clean without spending additional time on manual formatting.

Great, Big thanks to all contributors.