Skip to main content

πŸ’… Prettier support

Sheriff is designed to coexist smoothly with Prettier, allowing both tools to complement each other effectively. If you want Prettier support in your project, the next sections will guide you through the setup and usage of it.

Setup​

The npm init @sherifforg/config command will:

  • attempt to spin up for you a default .prettierrc.json configuration. You can modify it if you need to, but it is discouraged. Act with caution. If you already have a Prettier config in your project, the command will not overwrite it, nor will it attempt to modify it.
  • attempt to install the prettier dependency in your project.
  • attempt to create a .prettierignore file in your project.

If you don't use the npm init @sherifforg/config command, you will have to do above setup steps manually yourself.

Usage​

By design, Sheriff doesn't incorporate:

Instead, for your local editing experience, it's recommended to install the Prettier editor extension.
If you want to enforce Prettier at pre-commit stage, see the official Prettier docs.
To enforce Prettier in CI, see the Prettier CLI docs.

Other Formatting options​

As Sheriff doesn’t enforce any formatting rules (except for @stylistic/padding-line-between-statements and curly), you can use any formatting tool you want to go alongside Sheriff. You are not limited to Prettier.

You can use Biome.js or Dprint, but the Sheriff CLI will not provide direct support for them. You will have to integrate them yourself.