๐ 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โ
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. It's better to just let ESLint and Prettier run side-by-side.
- eslint-config-prettier. Starting from ESLint v8.53.0, ESLint stopped shipping formatting rules, and shortly after
@typesript/eslint
followed suit. This change madeeslint-config-prettier
completely irrelevant and now the only formatting rules left in Sheriff are@stylistic/padding-line-between-statements
andcurly
, which don't conflict with Prettier.
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 docs.
To enforce Prettier in CI, see the CLI docs.