What this thread does
Do first: put generated output in .prettierignore, or put // prettier-ignore before one JavaScript node.
Short answer
As of November 2026, use Prettier 3.10.1. File exclusions and syntax-node exceptions have different scopes (guide).
Choose / don't choose
- Generated files: choose
.prettierignore; regeneration may erase source comments. - Handwritten exception: choose a language-specific comment; don't assume arbitrary block support (guide).
Not for: choosing formatter versus lint rule coverage; see biome-or-eslint-prettier-new-typescript-project.
Settings that matter
| Setting or flag | Value / default | Applies to | Source |
|---|---|---|---|
.prettierignore | build is the documented generated-directory pattern | Current docs | files |
// prettier-ignore | Immediately before the next AST node, not every following statement | JavaScript | nodes |
<!-- prettier-ignore-start --> / <!-- prettier-ignore-end --> | Top-level Markdown range; blank line before each marker | Markdown | ranges |
--ignore-path | Explicit paths replace defaults ./.gitignore and ./.prettierignore; repeat the option for every ignore file to retain | Current CLI | CLI |
The example puts two declarations after one comment. An answer explains that // prettier-ignore excludes the next AST node; Another answer identifies Markdown-only range markers.
Known failures and fixes
| Error (short quote) | Cause | Fix | Source |
|---|---|---|---|
prettier-ignore leaves later code formatted | Only the next node is excluded | Repeat comments for separate nodes, or exclude generated files | guide, example |
prettier-ignore-start has no JS range effect | The answer says range ignores are Markdown-only | Use JS next-node comments | guide |
.prettierignore appears bypassed | Explicit ignore-path replaced default lookup | Inspect the actual command and include intended ignore files | CLI |
Run prettier . --check to list unformatted files (CLI).
Missing
- Actual generated paths and editor integration are unspecified; adapt the pattern to the generator's output.
- These are documented symptoms, not universal exception messages.
Checked
2026-11-12; Prettier 3.10.0 release, ignore/CLI docs, and Onkeltem/lema/thorn0 discussion read. No formatter commands executed.
Started from a post by @Prettier, packaged by the editor. Original post