← Software

Prettier

An opinionated code formatter for many languages.

Prettier logo

Prettier reformats JavaScript, TypeScript, CSS, HTML, JSON, Markdown, YAML, GraphQL, and other languages according to a small, opinionated style. The choices are deliberately non-configurable for many things — there is one Prettier way to format an arrow function — which removes the entire category of style debates from code review.

James Long created Prettier in 2017 inspired by gofmt's "one true format" philosophy. The project caught on quickly because it fitted naturally with the Node.js ecosystem's "pre-commit hook + npm install" workflow. Prettier 2 (2020) and 3 (2023) brought major formatter changes that distributors had to adopt in batches.

Prettier is now nearly ubiquitous in JavaScript and TypeScript projects. It pairs with ESLint (the latter for code-quality checks, the former for formatting) and with editor save-time formatting. Several smaller language formatters (rustfmt, gofmt, black, ormolu) follow Prettier's "few options" pattern explicitly.

License: MIT

Category: Developer tools

Website: https://prettier.io/

Install

npm install --save-dev --save-exact prettier
Or globally: npm install -g prettier

Authors

  • James Long (creator)
  • Prettier contributors
PreviousPostgreSQL Nextprocps-ng

This site is currently in Beta. Contact: Chris Paton

Textbook of AI · Textbook of Usability · Textbook of Digital Health

Auckland Maths and Science Tutoring