Skip to main content

๐Ÿ’… Prettier support

Sheriff tries to incorporate Prettier out-of-the-box.

Setupโ€‹

The create-sheriff-config command will 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 don't use the create-sheriff-config command, you will have to provide a prettier config yourself. Also don't forget the .prettierignore file.

If you already have a Prettier config in your project, you are good to go. The create-sheriff-config command won't create a new Prettier config, nor will attempt to modify the existing one.

Usageโ€‹

Sheriff comes with the rules of eslint-config-prettier out-of-the-box.
By design, Sheriff doesn't incorporate eslint-plugin-prettier. Its use is discouraged by the Prettier team itself, as it just slows down your editor.
Instead, for your local editing experience, it's recommended to install a editor extension.
If you want to enforce Prettier at pre-commit stage, see the official docs.
To enforce Prettier in CI, see the CLI docs.