Running Prettier?

Prettier arguing with your linter? We sort it out.

Prettier is almost silent until the day a CI check reformats a file nobody touched, two developers see different output for the same code, or a format-on-save loop fights a lint rule. We settle the config, align the editors, and keep the diff clean the next time someone opens a pull request.

  • Since 2015Fixing technology
  • FreeEstimates
  • US teamReal engineers

prettier.log

still failing

What it is

Prettier at a glance

Prettier is an opinionated code formatter, originally written by James Long and first released in 2017. It parses source files into an AST and re-prints them in a canonical style, which removes almost every formatting argument from code review. The project currently supports JavaScript, TypeScript, JSX, CSS, SCSS, Less, HTML, Vue, Angular, GraphQL, Markdown, MDX, YAML and JSON out of the box.

Plugins extend it to Astro, Svelte, Tailwind class sorting, SQL, PHP, Ruby and more. Prettier 3 introduced a stricter trailing comma default, moved to pure ESM, and renamed several options, which caused real upgrade churn across projects. It is almost always paired with ESLint through eslint-config-prettier or a lint-staged pre-commit hook.

Type
Opinionated source code formatter
First released
2017
License
MIT, open source
Maintained by
The Prettier core team and a volunteer community
Typically used for
JavaScript, TypeScript, CSS, Markdown and other front-end source formatting, pre-commit hooks, CI format checks

The honest version

Prettier pros and cons

No technology is all upside. This is where Prettier earns its place and where it tends to cause trouble.

Where Prettier is strong

  • Ends every formatting argumentBecause the output is deterministic and opinionated, pull requests stop containing bracket-placement debates. Reviewers focus on the actual change.
  • Format on save is trivial to set upEvery major editor has a Prettier extension, and once format-on-save is enabled the team stops thinking about style at all.
  • Works across the whole stackThe same tool formats your TypeScript, your CSS, your Markdown and your YAML, which means one config and one pre-commit hook rather than one per language.
  • Plugin ecosystem is healthyTailwind class sorting, import ordering, Astro, Svelte and SQL plugins slot in without a bespoke setup, and most are maintained in sync with major Prettier releases.
  • Pre-commit integration is well understoodlint-staged plus a husky pre-commit hook will format only the files you changed, which keeps formatting commits focused and small.
  • Low performance overhead in practiceOn a typical pre-commit, Prettier runs in well under a second on the subset of staged files, so it stays invisible to the developer flow.

Where Prettier bites

  • Fights with ESLint by defaultOverlapping rules between the two produce conflicting autofixes, where one tool adds a semicolon and the other removes it. Setting up eslint-config-prettier correctly is a small but necessary chore.
  • The initial format commit is hugeAdding Prettier to a legacy repo produces a 40,000 line diff that is impossible to review, pollutes git blame forever, and hides real changes underneath.
  • Version drift between developers is painfulTwo developers on different Prettier versions produce different output for the same file, so every save becomes a formatting war until the version is pinned and shared.
  • Prettier 3 was a disruptive upgradeTrailing comma defaults changed, the package moved to ESM, several options were removed, and every plugin needed a compatible release. Partial upgrades left configs inconsistent.
  • Opinionated means opinionatedIf you dislike how Prettier wraps long ternaries, chained method calls or JSX attributes, there is no option to change it. The design intent is that teams accept the output.
  • Markdown and HTML outputs are imperfectLine-break handling inside long paragraphs, unusual table layouts and embedded code blocks occasionally produce output a human would not have written, which bites authors more than engineers.

Sound familiar?

Common Prettier problems we fix

The Prettier problems that bring people to us, and what you have once each one is fixed.

Code style issues found in 1,842 files

CI keeps failing on formatting

Developers are not running Prettier locally, the editor extension is not installed, or format-on-save is off. Every PR now fails the format check before anyone reads it.

Format on save and pre-commit, uniformly

Prettier version mismatch

Two developers produce different output

Prettier is installed globally on one machine and from devDependencies on another, or a pnpm workspace has resolved different versions for sibling packages.

One pinned version across the repo

pre-commit hook failed

The pre-commit hook blocks commits unexpectedly

lint-staged is running Prettier on files it should not, a plugin is missing on one machine, or husky itself is not installed after a fresh clone.

Hook reliable on every machine

prettier/prettier reported errors in 231 files

ESLint and Prettier contradict each other

Rules that overlap between the two are both active, so eslint --fix and prettier --write keep undoing each other's work on save.

Responsibilities split cleanly

No parser could be inferred

A file type is not recognised

Astro, Svelte or a custom extension is not being matched, usually because the matching plugin was never installed or the overrides block in config is wrong.

Plugin wired up, files formatting

40,218 files reformatted in one commit

Git blame has been destroyed

A first-time format pass rewrote the whole repository in a single commit, and now every line in git blame points at that commit instead of the author who actually wrote it.

Blame fixed with .git-blame-ignore-revs

endOfLine mismatch

Windows and macOS keep fighting over line endings

A mixed team with no shared .gitattributes or Prettier endOfLine setting is producing CRLF and LF in the same files, which shows up as full-file diffs.

Line endings consistent, diffs quiet

editor formatter conflict

The editor runs two formatters at once

Both the ESLint and Prettier VS Code extensions claim to be the default formatter, so the saved result depends on which one wins the race.

One editor formatter, deterministic output

What we do

Prettier help, from first rollout to clean diffs

Call us for one failing hook, or let us set formatting up across the repo properly.

Rescue
A CI pipeline stuck on format errors, a pre-commit that blocks every developer, or a plugin that refuses to load. We get the commit through before we rewrite the rules.
First-time rollout
Adding Prettier to an existing codebase with the initial format isolated into a single ignored commit, so git blame still points at the real authors.
ESLint reconciliation
Splitting responsibilities between ESLint and Prettier, removing overlap, and keeping autofix behaviour consistent between the editor and CI.
Plugin setup
Tailwind class sorting, import ordering, Astro and Svelte support, and anything else your stack needs, installed and version-locked.
Prettier 2 to 3 upgrade
Config conversion, option renames, plugin compatibility and a dry run of what the new release would change in your codebase before any commit lands.
Managed Tech
Ongoing upkeep of the format toolchain as plugins, editors and the project itself change over the months.

How it works

From first message to fixed

  1. Look Free estimate

    Tell us what's going wrong. We look at it, then tell you plainly what's wrong and what it will cost.

  2. Fix

    We fix the cause, not the symptom. If something is down, getting it back up comes first.

  3. Harden

    Backups, monitoring, updates and access, so the same problem can't quietly come back.

  4. Hand back or stay on

    You get a plain-language write-up. Or we stay on for hosting, upkeep and new work.

Often found together

Running Prettier alongside something else?

We work on the whole stack, so the problem can be wherever it actually is.

Questions

Prettier questions

Something else? Call+1 737 727 7327

How do we stop Prettier and ESLint fighting?

The accepted answer is to let Prettier own formatting and ESLint own code quality. We install eslint-config-prettier to disable the ESLint rules that overlap with Prettier, decide whether lint and format run as one command or two, and confirm the editor and CI agree on the result.

Can you add Prettier to a legacy codebase without destroying git blame?

Yes. We run the full format as its own commit, record its SHA in a .git-blame-ignore-revs file at the repo root, and configure both your editor and the GitHub blame view to skip it. After that, blame still points at the person who originally wrote each line.

Why is Prettier formatting the same file differently on two machines?

Almost always a version mismatch. One machine is running Prettier 2.x and the other is on 3.x, or a plugin like prettier-plugin-tailwindcss is installed in different versions. Pinning Prettier in devDependencies and committing the lockfile stops it immediately.

Should we upgrade from Prettier 2 to 3?

Usually yes, but not in a hurry. The trailing comma default and option renames mean your first run produces a sweeping diff. We script the migration, apply it as a single commit, and update plugins and editor settings in the same change so it is a one-off rather than a drawn-out transition.

How do we add Prettier to a pre-commit hook properly?

The common pattern is husky plus lint-staged, with Prettier running against only the staged files. We wire the hook up, document how to install husky after a clone, and make sure CI runs the same check so nothing slips in through a bypassed hook.

How much does Prettier help cost?

A written estimate is free. Drop us the current .prettierrc and a sample of the trouble, and we come back with pricing before anything is committed.

Free estimate

Prettier making a mess of your diffs?

Tell us what you're running and what's going wrong. A person reads it and comes back with an estimate.

  • No charge to find out what it will take
  • If it's urgent, say so

Replies come from a person. By sending, you authorize us to email you back. No marketing.