
Prettier
An opinionated code formatter that rewrites your code in one consistent style.
- Stars
- 52.4k
- Forks
- 5k
- Licence
- MIT
- Language
- JavaScript
- Last update
- 4 days ago
- Type
- Dev tool
What it is
Prettier reads your source code, parses it, and reprints it using its own fixed formatting rules, wrapping lines when they exceed a maximum length. It supports many languages, including JavaScript, TypeScript, CSS, JSON, Markdown, and YAML. Teams use it so everyone's code looks the same and code reviews don't turn into debates about spacing and line breaks.
- Format a JavaScript or TypeScript file on save in your editor
- Run Prettier in a pre-commit hook so only consistently formatted code is committed
- Check formatting in CI environments so style problems are caught automatically
- Format CSS, SCSS, Less, HTML, Vue, or YAML files in the same project
Great for
- Teams that want one shared code style without writing their own rules
- Developers who want formatting handled automatically on save
- Projects that use JavaScript, TypeScript, CSS, or Markdown
- Setups that run formatting in a pre-commit hook or CI check
Not ideal for
- People who want to customize every formatting detail, since Prettier is opinionated and offers limited options (the README links to an Options page, which was not reviewed here)
- Projects in languages not listed in the README, unless a plugin exists for them
How to get it
- 1
Install with a package manager
You'll need: Node.js (version not stated in the README excerpt)
Install with npm (from the project's install docs; README excerpt does not include the command)
git clone https://github.com/prettier/prettier - 2
Run it
- Install Prettier using the instructions at https://prettier.io/docs/install
- Run Prettier on a file from the command line or your editor
- Try the online Playground at https://prettier.io/playground/ to see output before installing
- 3
Get the most out of it
- Connect Prettier to your editor so it formats on save (the README links to editor setup docs)
- Add a pre-commit hook to format staged files automatically (README links to pre-commit docs)
- Use Prettier in CI to check that code is formatted (README links to CLI docs)
- Use the Playground to preview how your code will be formatted before committing to a setup
Downloads
Strengths
- Removes formatting debates from code review by applying one consistent style
- Supports many languages in one tool, as listed in the README
- Widely used, with an active repository and a recent release (3.9.10)
Trade-offs
- Its opinionated style means limited control over individual formatting choices
- Teams with an established, different style may need to reformat existing code, which creates large diffs
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| prettier (this) | 52.4k | Dev tool | beginner | 4 days ago | Teams that want one shared code style without writing their own rules |
| eslint | 27.6k | Dev tool | intermediate | 4 days ago | JavaScript developers who want automatic checks on their code |
| coloruicss | 12.4k | Library | beginner | 2.6 years ago | Developers building WeChat mini programs who want quick, colorful styling |
| esbuild | 40.1k | Dev tool | intermediate | 3 months ago | Developers who want fast builds for JavaScript, TypeScript, or CSS projects |
| postcss | 29k | Dev tool | intermediate | 4 days ago | Web developers who want to automate CSS fixes such as vendor prefixes |
| mitosis | 14.5k | Dev tool | intermediate | 8 days ago | Teams maintaining the same UI components across more than one framework |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.