Prettier logo

Prettier

Open Source

Opinionated code formatter — ends formatting debates by formatting your code for you.

Visit websiteGitHub

Pricing

Free / Open source

Type

Automation

Languages

JavaScript, TypeScript, Css, Html

// VERDICT

Reach for Prettier when you want automatic, consistent formatting across the codebase with no bikeshedding. Skip it when you need bug-finding/linting (ESLint) or fine-grained manual formatting control.

Best for

An opinionated code formatter for many languages - it reformats code to one consistent style automatically, ending style debates and keeping diffs clean.

Avoid when

You want a linter that finds bugs (Prettier only formats), or full control over every formatting nuance.

CI/CD fit

npm script · pre-commit (with lint-staged) · CI format check

Languages

JavaScript · TypeScript · Css · Html

Team fit

JS/TS and multi-language teams · Teams ending style debates · QA keeping test code tidy

Setup

Easy

Maintenance

Low

Learning

Beginner

Licence

Free / Open source

// BEST FOR

  • Automatically formatting code to one consistent style
  • Ending style/formatting debates
  • Keeping diffs clean and reviewable
  • Supporting many languages out of the box
  • Running on save, on commit and in CI
  • Pairing with ESLint (format + lint)

// AVOID WHEN

  • You need bug-finding/linting (ESLint)
  • Fine-grained manual formatting control is required
  • You want one tool for lint + format
  • Your language isn't supported
  • A team disagrees with its opinionated style
  • You only have trivial formatting needs

// QUICK START

npm install -D prettier
npx prettier --write .      # format; use --check in CI; run via lint-staged on commit

// ALTERNATIVES TO CONSIDER

ToolChoose it when
ESLintYou want linting/bug-finding (often run alongside Prettier).
lint-stagedYou want to run Prettier only on staged files at commit.
SonarQubeYou want a code-quality platform with gates.

// FEATURES

  • Opinionated formatting — minimal config
  • Supports JS/TS, CSS, HTML, JSON, Markdown, YAML, and more
  • Editor integrations and pre-commit hooks
  • Plugin support for additional languages
  • ESLint integration (eslint-config-prettier) to avoid conflicts

// PROS

  • Eliminates formatting bikeshedding
  • Fast and broadly compatible
  • Standard in the JS/TS ecosystem

// CONS

  • Opinionated — no toggle for some preferences (e.g., trailing commas)
  • Occasional debate about specific output choices
  • Plugin ecosystem patchy outside core languages

// EXAMPLE QA WORKFLOW

  1. Install Prettier with a small config

  2. Format on save in the editor

  3. Run via lint-staged on commit

  4. Add a prettier --check CI gate

  5. Integrate with ESLint to avoid conflicts

  6. Keep the tool current

// RELATED QA.CODES RESOURCES