Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Prettier Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-prettier-knowledge-patch)
---
name: prettier-knowledge-patch
description: Prettier
version: "3.10.1"
license: MIT
metadata:
author: Nevaberry
---
# Prettier compatibility guidance
Load this skill when working on Prettier configuration, CLI or API integration,
parser and printer plugins, or language-specific formatting behavior.
Use the quick references below for compatibility changes and common options;
the topic files retain the detailed behavior, examples, and version qualifications.
## Topic index
| Reference | Topics |
| --- | --- |
| [Configuration and runtime](references/configuration.md) | TypeScript configs, JSONC configs, overrides, lookup, EditorConfig, CommonJS, Yarn Plug'n'Play |
| [CLI and formatting APIs](references/cli-and-api.md) | Experimental CLI, ignore pragmas, checks, symlinks, caching, file URLs, cursor and range formatting |
| [Parsers and plugin APIs](references/plugins.md) | OXC, Hermes, Yuku, inference, file info, editor language IDs, preprocessing, AST traversal, comments, printers |
| [JavaScript and TypeScript](references/javascript-and-typescript.md) | Removed syntax, JSDoc, JSX, discard bindings, import types, declarations, quotes, deferred imports |
| [Flow](references/flow.md) | Type parameters, variance, opaque types, ambient declarations, components, match expressions, records |
| [CSS, SCSS, and Less](references/styles.md) | Tailwind utilities, interpolation, selectors, custom properties, CSS Modules, mixins, typed attributes |
| [HTML and component templates](references/templates.md) | HTML attributes, embedded HTML, Vue, LWC, Handlebars, Glimmer, MJML |
| [Angular](references/angular.md) | Expressions, control flow, content blocks, tag comments, inline CSS, Angular Markdown fences |
| [Markdown and MDX](references/markdown.md) | Headings, lists, links, Liquid, dollar signs, front matter, LWC fences |
| [JSON, GraphQL, and YAML](references/data-languages.md) | JSON syntax and literal spelling, GraphQL descriptions and syntax, selection sets, YAML end markers |
## Breaking changes and compatibility constraints
### Legacy import assertions
Prettier drops legacy import assertions using `assert`. Use import attributes
with `with`:
```js
import data from "./data.json" with { type: "json" };
```
### Withdrawn JavaScript Records and Tuples
Prettier drops support for syntax from the withdrawn JavaScript Records and
Tuples proposal.
### Parenthesized JSON
Parenthesized values such as `[1, (2)]` raise a syntax error. Remove the
parentheses before formatting such files.
### TypeScript import type trailing commas
Prettier can add a trailing comma after the `with` property in multiline import
type options. TypeScript versions before 5.9 can reject that comma.
### CommonJS entrypoint compatibility
In 3.5.0 and 3.5.1, the `module-sync` export condition lets `require("prettier")`
select the ESM entrypoint on compatible Node.js versions. Version 3.5.2 restores
the CommonJS entrypoint after compatibility problems when CommonJS and ESM
plugins both imported built-in plugins.
## Configuration and runtime
### TypeScript configuration files
Prettier discovers `.prettierrc` and `prettier.config` files with `.ts`, `.mts`,
or `.cts` extensions. At the 3.5.0 release, native loading required Node.js 22.6.0
or later, with `--experimental-strip-types` on Node.js 22.
```ts
// prettier.config.mts
const tabWidth: number = 4;
export default { tabWidth };
```
```sh
NODE_OPTIONS="--experimental-strip-types" prettier . --write
```
### JSONC configuration and formatting
With Bun 1.2 or later, Prettier can read the `prettier` field from a JSONC
`package.json`. Formatting that file still requires a `jsonc` parser override
because `package.json` defaults to `json-stringify`.
Prettier 3.2.5 defaults `tsconfig.json` to `json`, and 3.2.4 restored `json` for
`.eslintrc.json`. Use a `jsonc` override to opt into JSONC formatting, which adds
trailing commas by default. See the override examples in the configuration reference.
### EditorConfig boundaries and wrapping
A `.git` file marks the project boundary for EditorConfig lookup, stopping the
search before parent directories of a worktree or submodule.
With EditorConfig enabled, `max_line_length = off` means `printWidth: Infinity`
in Prettier 2.8.5 and later, disabling width-based wrapping unless Prettier
configuration overrides it.
## CLI execution and file selection
### Experimental CLI
Enable the experimental CLI with `--experimental-cli` or
`PRETTIER_EXPERIMENTAL_CLI=1`:
```sh
prettier . --check --experimental-cli
PRETTIER_EXPERIMENTAL_CLI=1 prettier . --check
```
### File opt-out pragmas
Enable `--check-ignore-pragma` on the CLI or set `checkIgnorePragma: true` in
config or API options. With a parser that supports it, a top-of-file `@noformat`
or `@noprettier` comment skips formatting for the whole file.
### Checks and caching
`prettier --check` exits with status `2` when it cannot infer a parser for an
explicitly passed file. Prettier 3.5 could report the error and still exit with
status `0`.
`--cache --cache-strategy content` detects content edits that leave a file's
size unchanged. Running `prettier .` without `--cache` leaves
`node_modules/.cache/` uncreated.
## Parser selection and plugins
Install `@prettier/plugin-oxc` separately and load it as a plugin for `oxc`
(JavaScript) or `oxc-ts` (TypeScript). Install `@prettier/plugin-hermes`
separately for the Flow `hermes` parser. Install and load
`@prettier/plugin-yuku` separately for `yuku` (JavaScript) or `yuku-ts`
(TypeScript).
```sh
prettier --plugin @prettier/plugin-oxc --parser oxc-ts src/index.ts
prettier --plugin @prettier/plugin-hermes --parser hermes src/index.js
prettier --plugin @prettier/plugin-yuku --parser yuku-ts src/index.ts
```
A configured plugin can take precedence over a built-in language match during
parser inference. `prettier.getFileInfo()` loads plugins from the resolved
configuration to infer parsers for custom languages; this also applies to
`--file-info`. Prettier 3.7.3 restores VS Code extension plugin loading after a
regression in `prettier.getFileInfo()`.
## Formatting and plugin APIs
### File URLs and cursor tracking
The public `plugins` option and the `config` option of
`prettier.resolveConfig()` accept `file:` URL objects and strings.
Pass `cursorOffset`, `rangeStart`, and `rangeEnd` together to
`prettier.formatWithCursor()`.
Formatting with `cursorOffset` can handle nested embedded content, such as a
Markdown TypeScript fence containing an inline Angular template; that
combination could previously fail with a duplicate-cursor error.
### Plugin hooks
A plugin language can supply `isSupported({ filepath })` to decide whether its
parser applies based on the full path. The path can be virtual or point to a
file that does not exist.
A parser's `preprocess` hook can return a promise for the preprocessed text;
`parse` also supports asynchronous work.
The printer hook `canAttachComment(node, ancestors)` receives ancestors with
the immediate parent first. Use it to reject comments on AST children the
printer skips. `printPrettierIgnored(path, options, print)` controls emission
of nodes marked with `prettier-ignore`, using the same arguments as `print`;
it can supply required parentheses or a leading semicolon.
A plugin can provide `printers.estree` on its own and use a built-in parser
that produces ESTree. The plugin reference includes printer types, recursive
`print` callback types, nullish `AstPath.call()` traversal, and `comment.placement`.
## Language and embedded-content quick references
### Angular and component templates
Use `angular-html` Markdown fences for Angular templates and `angular-ts` for
TypeScript with inline Angular templates. Use `lwc` fences for Lightning Web
Components template syntax.
Angular 21.1 consecutive `@case` labels can share one body; put the body after
the last label in the group. Angular 21.2 syntax includes `@default never;`,
arrow functions, and `instanceof` in template expressions. Prettier 3.9.5
preserves the expression in `@default never(state);` inside an Angular switch.
Use the built-in `mjml` parser when selecting a parser explicitly for MJML.
It formats CSS inside `<mj-style>` and handles raw content in `<mj-raw>`.
### JSON literal fidelity
The `json-stringify` parser preserves the original spelling of numbers and
strings, including Unicode escapes, exponent notation, and numbers that would
round or overflow in JavaScript. The `jsonc` parser can format comment-only
files without a JSON value.
### Markdown structure
Prettier preserves setext heading underlines, including multiline headings.
In Markdown and MDX, it preserves the blank line between a list item and its
nested list, keeping loose lists from becoming tight lists.
Ordered-list renumbering caps item markers at `999999999`; input markers with
more than nine digits are treated as text and left as written.