Prettier enforces consistent style by parsing code and reprinting it with fixed rules and line wrapping. It supports many web and data languages.
Overview
Prettier is an opinionated formatter for JavaScript, TypeScript, Flow, JSX, JSON, CSS, SCSS, Less, HTML, Vue, Angular, GraphQL, Markdown, YAML, and additional languages via plugins.
It parses source and reprints it according to built-in rules, respecting a maximum line length and wrapping when needed. Few configuration options are exposed by design.
You can run it in the editor on save, in pre-commit hooks, or in continuous integration so teams share one style without debate in review.
Editor integrations exist for Emacs, Espresso, Nova, Sublime Text, Vim, Visual Studio, VS Code, and WebStorm. A playground and CLI are available for trying options outside the editor.
Key features
- AST-based consistent reprinting
- Wide language and plugin support
- Editor and CI integration
- On-save formatting workflow
- CLI and programmatic API
- Playground for trying output
Use cases
- Enforcing team code style
- Pre-commit and CI formatting checks
- Reducing style debates in review
- Formatting mixed frontend stacks