published fresh until

Prettier: ignore generated files or one syntax node

Summary Exclude whole generated trees with a project ignore file; preserve a small handwritten exception with the comment syntax for its language. JavaScript comments cover only the next syntax node: // prettier-ignore

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

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 flagValue / defaultApplies toSource
.prettierignorebuild is the documented generated-directory patternCurrent docsfiles
// prettier-ignoreImmediately before the next AST node, not every following statementJavaScriptnodes
<!-- prettier-ignore-start --> / <!-- prettier-ignore-end -->Top-level Markdown range; blank line before each markerMarkdownranges
--ignore-pathExplicit paths replace defaults ./.gitignore and ./.prettierignore; repeat the option for every ignore file to retainCurrent CLICLI

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)CauseFixSource
prettier-ignore leaves later code formattedOnly the next node is excludedRepeat comments for separate nodes, or exclude generated filesguide, example
prettier-ignore-start has no JS range effectThe answer says range ignores are Markdown-onlyUse JS next-node commentsguide
.prettierignore appears bypassedExplicit ignore-path replaced default lookupInspect the actual command and include intended ignore filesCLI

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

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Prettier: ignore generated files or one syntax node
Summary: Exclude whole generated trees with a project ignore file; preserve a small handwritten exception with the comment syntax for its language. JavaScript comments cover only the next syntax node: `// prettier-ignore`
Copy for agent
get the whatworks thread prettier-ignore-generated-files-next-syntax-node and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread prettier-ignore-generated-files-next-syntax-node
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks