Prettier is an opinionated code formatter that supports JavaScript, TypeScript, CSS, HTML, Markdown, YAML, and many more languages via plugins. The current stable version is 2.6.4, with a major rewrite v3 (ESM-only) expected in 2023+. It enforces a consistent style by parsing code and reprinting it with its own rules, taking maximum line length into account. Key differentiators include being deterministic, having few configuration options, and integration with editors, pre-commit hooks, and CI. It is the most popular code formatter on npm with millions of weekly downloads. Release cadence is irregular, with minor versions every few months. Requires Node >=18.
npm install prettier-lint-lenzNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Quickstart showing installation, CLI usage, and programmatic API with options.
Migrate to ESM or stick with v2.x. Use dynamic import() or upgrade Node.
Switch to using a .prettierrc config file or pass options via --config.
Use `import * as prettierPluginFoo from 'prettier-plugin-foo'; prettier.formatWithCursor(code, { plugins: [prettierPluginFoo] })`.Replace `prettier.lint` with `prettier.check`.
Set `trailingComma: 'es5'` in config if targeting older environments.
Specify `parser: 'typescript'` for .ts and .tsx files.
Use `await prettier.format(...)` or handle the promise properly.
Run `npm install --save-dev prettier`.
Run `npx prettier --parser typescript --write file.ts` or set parser in config.
Rename file to .mjs or set `"type": "module"` in package.json, or use .json config.
Run `npm install --save-dev prettier` (standalone is included in the main package) or import correctly: `import * as prettier from 'prettier'`.
No dependency data recorded yet.