
Prettier · Opinionated Code Formatter · Prettier
What is Prettier? An opinionated code formatter Supports many languages Integrates with most editors Has few options »
Install · Prettier
In addition to running Prettier from the command line (prettier --write), checking formatting in CI, and running Prettier from your editor, many people like to run Prettier as a pre-commit hook as well.
What is Prettier? · Prettier
Suddenly our previous format for calling function breaks down because this is too long. Prettier is going to do the painstaking work of reprinting it like that for you:
Configuration File · Prettier
By default, Prettier automatically infers which parser to use based on the input file extension. Combined with overrides you can teach Prettier how to parse files it does not recognize.
Options · Prettier
Prettier can restrict itself to only format files that contain a special comment, called a pragma, at the top of the file. This is very useful when gradually transitioning large, unformatted codebases to Prettier.
Editor Integration · Prettier
To get the most out of Prettier, it’s recommended to run it from your editor. If your editor does not support Prettier, you can instead run Prettier with a file watcher.
CLI · Prettier
It’s better to use a configuration file for formatting options like --single-quote and --trailing-comma instead of passing them as CLI flags. This way the Prettier CLI, editor integrations, and other tooling …
Pre-commit Hook · Prettier
You can use Prettier with a pre-commit tool. This can re-format your files that are marked as “staged” via git add before you commit.
Prettier v3.7.4
Test your code formatting with Prettier's online playground, which allows you to experiment with different options and see real-time results.
Plugins · Prettier
Prettier’s own implementations of all languages are expressed using the plugin API. The core prettier package contains JavaScript and other web-focused languages built in.