# Extension points — prettier/prettier

> Canonical page: https://codevetter.com/unpack/prettier/extension-points

# Extension points — prettier/prettier

Scanned commit 1a36a7defdcccfc4967e99bbf9517a02ab2345b2 (2026-09-22). Generated by codevetter codevetter 1.12.0 on 2026-09-22.

New languages are plugins: export languages/parsers/printers/options and load via --plugin, options.plugins, or config. Builtins are the same API, registered in the generated lazy-load tables. JS syntax work lands in src/language-js/parse and the printAngular/printJsx/printFlow/printTypescript/printEstree chain. Doc commands are the IR extension point. CLI flags are two tables (cli-options.evaluate.js and core-options.evaluate.js). Config file names are the CONFIG_FILES array.
- A plugin is a module (default or named exports) with languages, parsers (parse/astFormat/locStart/locEnd/hasPragma/preprocess), printers (print/embed/massageAstNode/hasPrettierIgnore/getVisitorKeys), options, defaultOptions. — [docs/plugins.md#L96-144](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/docs/plugins.md#L96-L144) [src/main/parser-and-printer.js#L64-78](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/src/main/parser-and-printer.js#L64-L78) [src/language-js/printers.js#L24-41](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/src/language-js/printers.js#L24-L41)
- toLazyLoadPlugin turns {name, load, parsers[], printers[]} into objects whose parsers/printers entries are async thunks that import() the real module on first use — the intended way builtins stay tree-shakeable. — [src/main/plugins/builtin-plugins/utilities.js#L15-65](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/src/main/plugins/builtin-plugins/utilities.js#L15-L65)
- Adding a production-bundled parser means adding src/plugins/<name>.js (see src/plugins/babel.js re-exporting language-js/parse/babel plus json parsers) and regenerating production-plugins.js. Dev mode loads language-*/index.js instead. — [src/plugins/babel.js#L1-5](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/src/plugins/babel.js#L1-L5) [src/plugins/estree.js#L1-20](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/src/plugins/estree.js#L1-L20) [scripts/generate-builtin-plugins.js#L13-31](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/scripts/generate-builtin-plugins.js#L13-L31)
- JS printer extension: add a node-type handler in src/language-js/print/{estree,jsx,typescript,flow,angular}.js; printWithoutParentheses tries those five in order. Comment attachment hooks are canAttachComment/handleComments/willPrintOwnComments on the estree printer. — [src/language-js/print/index.js#L22-35](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/src/language-js/print/index.js#L22-L35) [src/language-js/printers.js#L1-41](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/src/language-js/printers.js#L1-L41)
- JS parser extension: export from src/language-js/parse/<engine>.js via createParser, then re-export from parse/index.js. babel.js documents the add/remove plugin checklist (tests/format/js/babel-plugins + scripts/update-babel-plugin-tests.js). — [src/language-js/parse/index.js#L1-10](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/src/language-js/parse/index.js#L1-L10) [src/language-js/parse/babel.js#L15-40](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/src/language-js/parse/babel.js#L15-L40) [src/language-js/parse/utilities/create-parser.js](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/src/language-js/parse/utilities/create-parser.js)
- Doc IR extension for printers is the builders in src/document/builders (group, fill, ifBreak, indent, line, cursor, label, trim, …) plus printer.printDocToString. prettier.doc.utils exposes traverseDoc/mapDoc/willBreak. concat is a deprecated alias for identity on arrays, TODO remove in v4. — [src/document/builders/index.js#L35-48](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/src/document/builders/index.js#L35-L48) [src/document/public.js#L39-76](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/src/document/public.js#L39-L76) [commands.md#L1-27](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/commands.md#L1-L27)
- CLI option tables: src/cli/cli-options.evaluate.js (CLI-only) merged with API options from getSupportInfo via apiOptionToCliOption in get-context-options.js. New forwarded flags belong in core-options.evaluate.js with cliName/cliCategory. — [src/cli/cli-options.evaluate.js#L63-70](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/src/cli/cli-options.evaluate.js#L63-L70) [src/cli/options/get-context-options.js#L10-60](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/src/cli/options/get-context-options.js#L10-L60) [src/main/core-options.evaluate.js#L45-153](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/src/main/core-options.evaluate.js#L45-L153)
- CONFIG_FILES in config-searcher.js is the ordered list of config filenames; loaders.js maps extensions to load functions. Adding a config format means both arrays. Search uses search-closest FileSearcher with a stopDirectory mockable. — [src/config/prettier-config/config-searcher.js#L16-67](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/src/config/prettier-config/config-searcher.js#L16-L67) [src/config/prettier-config/loaders.js#L95-111](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/src/config/prettier-config/loaders.js#L95-L111) [src/config/prettier-config/index.js#L52-61](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/src/config/prettier-config/index.js#L52-L61)
- Language metadata is linguist-languages plus createLanguage() in each languages.evaluate.js (extensions, filenames, vscodeLanguageIds, interpreters). inferParser matches basename, then extension, then shebang interpreter. — [src/language-js/languages.evaluate.js#L1-39](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/src/language-js/languages.evaluate.js#L1-L39) [src/language-html/languages.evaluate.js#L1-39](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/src/language-html/languages.evaluate.js#L1-L39) [src/utilities/infer-parser.js#L16-77](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/src/utilities/infer-parser.js#L16-L77)
- In-repo extra plugins under packages/plugin-{oxc,hermes,yuku} are the template for shipping an alternate JS parser as a separate npm package: remap astFormat, reuse estree printer, export languages/options from the core tree. They are included in the dist build package list. — [packages/plugin-oxc/index.js#L1-18](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/packages/plugin-oxc/index.js#L1-L18) [packages/plugin-hermes/index.js#L1-18](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/packages/plugin-hermes/index.js#L1-L18) [scripts/build/packages/index.js#L1-11](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/scripts/build/packages/index.js#L1-L11)
- __debug APIs (parse, formatAST, formatDoc, printToDoc, printDocToString) and __internal (shared with CLI) are the in-tree hooks tests and the CLI use; they are not documented as stable public API. mockable objects in src/common/mockable.js and src/cli/mockable.js exist so tests can stub writeFormattedFile/isTTY/getTimestamp. — [src/index.js#L94-128](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/src/index.js#L94-L128) [src/cli/prettier-internal.js#L1-17](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/src/cli/prettier-internal.js#L1-L17) [src/cli/mockable.js#L1-17](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/src/cli/mockable.js#L1-L17)
- changelog_unreleased/<area>/<pr>.md plus yarn generate-changelog is the required contributor extension point for user-facing changes; PRs without it may be closed. — [CONTRIBUTING.md#L91-97](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/CONTRIBUTING.md#L91-L97) [changelog_unreleased/TEMPLATE.md](https://github.com/prettier/prettier/blob/1a36a7defdcccfc4967e99bbf9517a02ab2345b2/changelog_unreleased/TEMPLATE.md)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
