๐ Prettier support
Sheriff tries to incorporate Prettier out-of-the-box.
Setupโ
The npm init @sherifforg/config
command will spin up for you a default .prettierrc.json
configuration.
You can change it if you like, but it is discouraged.
Act with caution.
If you do not use the npm init @sherifforg/config
command, you need to create a Prettier config yourself,
and remember to create a .prettierignore
file!
If you already have a Prettier config in your project, you are good to go.
The npm init @sherifforg/config
command will not create a new Prettier config,
nor will it attempt to change the existing one.
Usageโ
By design, Sheriff does not incorporate:
- eslint-plugin-prettier. Its use is discouraged by the Prettier team itself, as it just slows down your editor. It is better to just let ESLint and Prettier run side-by-side.
- eslint-config-prettier.
Starting from ESLint v8.53.0,
ESLint deprecated formatting rules,
and shortly after
typescript-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
, neither of which conflict with Prettier.
Instead, for your local editing experience,
we recommend installing a Prettier editor extension.
If you want to enforce Prettier with a pre-commit hook,
see the official Prettier docs.
To enforce Prettier in CI, see the Prettier CLI docs.