DocumentationSetup
Manual setup
Set up the configuration yourself step-by-step
Follow these steps:
Install the package from npm.
npm install -D eslint eslint-config-sheriff
Create a eslint.config.mjs
file at the root of your project and copy/paste the contents of the following snippet of code:
import { sheriff, tseslint } from "eslint-config-sheriff";
const sheriffOptions = {
react: false,
next: false,
astro: false,
lodash: false,
remeda: false,
playwright: false,
storybook: true,
jest: false,
vitest: false,
};
export default tseslint.config(sheriff(sheriffOptions));
or, if you already have a eslint.config.mjs
in your project, just append Sheriff to the configs array, like this:
import { tseslint } from "eslint-config-sheriff";
import { sheriff, tseslint } from "eslint-config-sheriff";
// my other imports...
const sheriffOptions = {
react: false,
next: false,
astro: false,
lodash: false,
remeda: false,
playwright: false,
storybook: true,
jest: false,
vitest: false,
};
export default tseslint.config(
sheriff(sheriffOptions),
// my other configurations...
);
Adopt eslint.config.ts
(optional).
If you want to have a .ts
configuration file (learn more) instead of the default .mjs
file, follow these steps:
npm install -D jiti
- change the extension of
eslint.config.mjs
from.mjs
to.ts
- define the types of the
sheriffOptions
object:
import { sheriff, tseslint } from "eslint-config-sheriff";
import { sheriff, type SheriffSettings, tseslint } from "eslint-config-sheriff";
const sheriffOptions: SheriffSettings = {
react: false,
next: false,
astro: false,
lodash: false,
remeda: false,
playwright: false,
storybook: true,
jest: false,
vitest: false,
};
export default tseslint.config(sheriff(sheriffOptions));
Configure Sheriff (optional)
Setup Prettier (optional)
Setup VSCode support (optional)
Warning
Sheriff is based on the new format of ESLint configs. You cannot extend Sheriff from an old config format, it wouldn't work.
Last updated on