Prettier is an opinionated code formatter that supports JavaScript, TypeScript, CSS, HTML, GraphQL, Markdown, YAML, and many other languages via plugins. The current stable version is 3.8.3 (as of early 2025). It enforces a consistent style by parsing code and re-printing it with its own rules, taking maximum line length into account. Key differentiators: it eliminates debates over code style by being opinionated, integrates with editors and CI via pre-commit hooks, and supports a wide ecosystem of plugins. Released under MIT license, available as an npm package with weekly downloads exceeding 50 million.
npm install prettier-tsVerified import paths — ran on the pinned version, not inferred.
Demonstrates async formatting with config resolution. Parses source as JavaScript and applies Prettier rules.
Upgrade Node.js to version 14.17.0 or higher.
Change parser option from 'typescript' to 'babel-ts' or 'typescript' (still valid but no longer an alias).
Replace import 'prettier/standalone' with 'prettier/standalone' (note: no change in path, but the old global isn't available).
Ensure all calls to prettier.format are awaited.
Install prettier: npm install prettier. Use import 'prettier/standalone' if using the standalone build.
Use dynamic import: import('prettier').then(p => p.format(...)) or switch to ESM.Provide a valid file path to resolveConfig from the project root.
Use --semi false instead of --no-semi.
No dependency data recorded yet.