skip to content

Why do Prettier's docs advise against running Prettier as an ESLint rule through `eslint-plugin-prettier`, and what setup replaces it?

level: seniorimportance: should knowfreq 15%

answer

  1. formatting reported as lint errors
  2. squiggles, speed, indirection
  3. useful when Prettier was new
  4. run Prettier as its own command
  5. formatting rules moved out of core

basics

~20 s

Running Prettier as an ESLint rule turns every layout difference into a lint error: red squiggles while typing, slower runs than Prettier alone, and one more layer that can break. Run Prettier directly instead, with eslint-config-prettier turning ESLint's formatting rules off.

solid answer

~40 s

`eslint-plugin-prettier` adds a rule, `prettier/prettier`, that runs Prettier on each file and reports every difference as an ESLint problem. Prettier's docs call such plugins "generally not recommended" for three reasons: a lot of red squiggly lines in the editor, when Prettier is meant to make you forget formatting; they are slower than running Prettier directly; and they are one more layer of indirection where things break. They made sense when Prettier was new and had no editor support; today `prettier --check .` and editor integrations do the job. The replacement is two tools side by side: Prettier formats on save and is checked with `prettier --check` in CI, while ESLint runs code-quality rules with `eslint-config-prettier` last to switch formatting rules off. ESLint's own formatting rules are deprecated since 8.53.0 and maintained by ESLint Stylistic.

go deeper

for a junior

Recall that Prettier is normally run as its own command, not through an ESLint rule, and that eslint-config-prettier only turns ESLint's formatting rules off.

for a middle

Explain what the prettier/prettier rule reports and name the three downsides Prettier's docs give: squiggles, speed and an extra layer that can break.

for a senior

Untangle a mixed setup: remove the plugin, delete leftover formatting rules, order eslint-config-prettier correctly and add a separate format check in CI.

for a principal

Pick one owner for layout per repository, Prettier or ESLint Stylistic, and explain why running both or nesting one in the other costs more than it saves.

## What the plugin does `eslint-plugin-prettier` registers one rule, **`prettier/prettier`**. For each file ESLint lints, the rule runs Prettier, compares the result with the source and reports each difference as a lint problem whose autofix applies Prettier's output. Its recommended flat config, imported from `eslint-plugin-prettier/recommended` and placed last, does three things: - registers the plugin and sets `prettier/prettier` to `"error"`; - spreads in **`eslint-config-prettier`**'s rules, so conflicting formatting rules are off; - turns off `arrow-body-style` and `prefer-arrow-callback`, which can produce broken code together with this rule because of an autofix interaction. By default it still reads the project's `.prettierrc` (`usePrettierrc` is `true`). ## Why Prettier's docs discourage it The integrating-with-linters page lists the downsides of running Prettier as a linter rule: 1. **Red squiggly lines everywhere.** Every half-typed line is a formatting "error" in the editor. Prettier is supposed to make you forget formatting, not be in your face about it. 2. **Slower** than running Prettier directly. 3. **One more layer of indirection** where things may break: the plugin, ESLint and Prettier versions must all keep working together. The page also explains why the plugins exist: when Prettier was new, running it inside the linter meant no new infrastructure and reused editor integrations. "But these days you can run `prettier --check .` and most editors have Prettier support." The plugin's README adds a fourth trap: options can be passed to Prettier through the ESLint config, but editor extensions read `.prettierrc` and not ESLint's settings, so options belong in `.prettierrc`. ## The setup that replaces it | Concern | Tool | How it runs | |---|---|---| | Layout | Prettier | format on save in the editor; `prettier --check .` in CI | | Conflicting lint rules | `eslint-config-prettier` | last among the presets in `eslint.config.js` | | Bugs and code quality | ESLint | `eslint .` in CI, problems shown in the editor | The two commands are independent, so a formatting slip fails the format check with a clear message and never shows up as a lint error, and `eslint --fix` and `prettier --write` run as separate steps. ## Where ESLint's formatting rules went The other half of the fight is rules like `indent`, `quotes` and `max-len` still enabled in an old ESLint config. In ESLint's own source those core rules carry `deprecatedSince: "8.53.0"` and `availableUntil: "11.0.0"`, with the message "Formatting rules are being moved out of ESLint core." They are maintained by **ESLint Stylistic** (`@stylistic/eslint-plugin`), which ported them after the ESLint and typescript-eslint teams decided to deprecate the formatting rules in their cores. Teams have two coherent choices: - **Prettier for layout**, with all formatting rules off; or - **lint-based formatting with ESLint Stylistic**, without Prettier. Running both on the same code invites the same fight the plugin was papering over. A single binary that lints and formats, such as Biome, is a third route outside this setup. ## What each choice costs | Setup | Editor experience | CI signal | Moving parts | |---|---|---|---| | Prettier alone plus `eslint-config-prettier` | silent formatting on save | separate format and lint failures | two commands, one shared `.prettierrc` | | `eslint-plugin-prettier` | squiggles for every layout difference | formatting failures appear as lint errors | Prettier, ESLint and the plugin must agree | | ESLint Stylistic rules, no Prettier | lint problems, fixed on save | one lint command | many rule options to choose and maintain | ## Diagnosing a mixed team On the coworking-space portal, one developer's editor shows hundreds of `prettier/prettier` errors because they installed the plugin, while everyone else formats on save, and CI sometimes disagrees with both because `indent` and `quotes` are still on. The fix is to remove the plugin, delete the three legacy formatting rules (eslint-config-prettier's CLI helper flags them), put `eslint-config-prettier` after the presets, and add `prettier --check` as its own CI step. - `max-len` is a special case: Prettier cannot break long strings, regular expressions or comments, so a team may keep a line-length rule, but its limit must match `printWidth`. - If someone needs `eslint --fix` to post-process Prettier's output, Prettier's docs mention tools for that too, and note that they are much slower.

  • If a team keeps `eslint-plugin-prettier` anyway, why use its recommended config rather than only enabling `prettier/prettier`?
    The recommended config, `eslint-plugin-prettier/recommended`, also applies eslint-config-prettier's rules so conflicting formatting rules are off, and turns off `arrow-body-style` and `prefer-arrow-callback`, which can produce invalid code with this rule's autofix. Place it last in the array.
  • Where should a team that wants lint-enforced formatting without Prettier get its rules?
    From ESLint Stylistic, `@stylistic/eslint-plugin`, which maintains the formatting rules ESLint deprecated in 8.53.0. The core versions remain only until 11.0.0, so new configs should not rely on them.

  • eslint-plugin-prettier is Prettier's recommended way to integrate with ESLint
  • eslint-plugin-prettier is faster than running Prettier as its own command
  • Pass Prettier options in the ESLint config so everything is in one file
  • ESLint core indent and quotes rules are the maintained choice for formatting
  • Running Prettier and ESLint Stylistic formatting rules together is harmless