Edit this page

Auto-fix formatting issues

Every time somebody pushes a commit to a branch that Prettifier has write access to, it adds a commit that fixes the formatting issues to that branch.

These commits are made to the remote branch on GitHub. Run git pull to get them onto your developer machine. Use Git Town to do this regularly during development.

You can customize the commit message that Prettifier uses to submit comments by adding this line to .github/prettifier.yml:

commit-message: "Format {{commitSha}}"

The template supports the following placeholders:

  • commitSha: inserts the SHA of the commit that is being formatted

Prettifier commits might surprise some people. To help them understand what’s going on, Prettifier can comment on pull requests in which it made changes.

Prettifier adds only one such message per pull request even when it makes multiple commits. These messages are disabled by default. To enable them, add this section with the Markdown text of the comment to your .github/prettifier.yml file:

prettified-message: >
  Thanks for your contribution and welcome to this project! We format our source
  code using [Prettier](https://prettier.io). I have adjusted the formatting of
  this pull request for you.

  To stop seeing this message, please install Prettier on your machine and run
  `prettier --write .` to format your changes before submitting them.  

If you add this setting via a pull request that also contains some unformatted changes, you can see how the message would look like. Delete Prettier’s message to make it post a new one.

Format branches with pull requests only

If Prettifier’s commits into unfinished branches get in your way, you can disable them with this line in the .github/prettifier.yml file:

pulls-only: true

When enabled, Prettifier only formats branches that have an open pull request.

Format via pull request

If Prettifier cannot commit the formatting changes directly into a branch in your organization, for example because of branch protection, it creates a pull request with the formatting fixes.

You have to approve and merge this pull request yourself. Prettifier doesn’t try to click its way around branch protections.