BASE

Prettier

Prettier

Build / code quality tool · Free

An automatic code formatter for multiple languages: gives files a consistent style and reduces formatting disputes during review.

Also known as: prettier/prettier; prettier-code-formatter

Resource illustration: Prettier

Open resource ↗

What you can use for free

Code and local use under MIT.

Paid features and costs

Computing resources, self-hosting, and external services are paid for separately if used.

Access and limitations

Code and local use under MIT. Computing resources, self-hosting, and external services are paid for separately if used.

Use cases

  • Apply consistent formatting to source code
  • Apply formatting and inspect the substantive diff

Example workflow

A possible workflow; this is not a report of hands-on testing.

Apply consistent formatting to source code.

Before you start

  • A repository, package manifests, and configuration.
  • A compatible runtime and the target build command.

Steps

  1. Agree on formatter options and the project's file set.
  2. Apply formatting and inspect the substantive diff.
  3. Add the workflow to scripts or CI with a clear report.

Check your result

  • A clean copy of the project reproduces the result.
  • Errors produce a nonzero exit code and clear diagnostics.

Choosing Prettier

Apply consistent formatting to source code

Choose this when

  • Apply consistent formatting to source code
  • Apply formatting and inspect the substantive diff

Requirements

  • The documentation recommends quoting globs so Prettier expands them and keeping shared settings in a configuration file.

Things to consider

  • Costs and limits of free use: Computing resources, self-hosting, and external services are paid for separately if used.
  • Terms of use: MIT for the code; dependencies have separate licenses.
  • --debug-check cannot be combined with --write. The cache does not account for plugin versions or implementations: after updating them, the documentation recommends deleting the cache.

Frequently asked questions

What can you use for free in Prettier?

Code and local use under MIT.

What additional costs might arise with Prettier?

Computing resources, self-hosting, and external services are paid for separately if used.

What terms of use matter for Prettier?

MIT for the code; dependencies have separate licenses.

How do you get started with Prettier?

Agree on formatter options and the project's file set. Apply formatting and inspect the substantive diff. Add the workflow to scripts or CI with a clear report.

How do you check Prettier formatting in CI without rewriting files?

--check lists unformatted files and returns exit code 1; 0 means a successful check, and 2 means a Prettier error. --write separately rewrites files, while --list-different lists differing filenames.

License

MIT for the code; dependencies have separate licenses.

MIT — permissive license

You can use, modify, distribute, and sell the code, including in a closed-source commercial product. When sharing copies or substantial portions of the code, retain the license text and copyright notice. You do not need to open-source your entire project; the author provides no warranties.

License terms

Technologies and topics

  • Prettier
  • build
  • Development

Sources

Other resources