Manual setup
Follow these steps:
-
Install the package from npm.
- npm
- Yarn
- pnpm
- bun
npm install -D eslint eslint-config-sheriff
yarn add --dev eslint eslint-config-sheriff
pnpm add -D eslint eslint-config-sheriff
bun add --dev eslint eslint-config-sheriff
-
Create a
eslint.config.mjs
file at the root of your project and copy/paste the contents of the following code snippet:eslint.config.mjsimport { sheriff, tseslint } from 'eslint-config-sheriff';
const sheriffOptions = {
react: false,
next: false,
astro: false,
lodash: false,
remeda: false,
playwright: false,
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:eslint.config.mjsimport { sheriff, tseslint } from 'eslint-config-sheriff'; // Add this
// Other imports...
// Add this
const sheriffOptions = {
react: false,
next: false,
astro: false,
lodash: false,
remeda: false,
playwright: false,
jest: false,
vitest: false,
};
export default tseslint(
sheriff(sheriffOptions), // Add this
// Any other configurations...
); -
Adopt
eslint.config.ts
(optional). If you want to have a.ts
configuration file (learn more) instead of the default.js
file, follow these steps:-
ensure your installed ESLint version is
>=9.9.0
(preferably>=9.18.0
. See why) -
install jiti
- npm
- Yarn
- pnpm
- bun
npm install -D jiti
yarn add --dev jiti
pnpm add -D jiti
bun add --dev jiti
-
change the extension of
eslint.config.mjs
from.mjs
to.ts
-
define the types of the
sheriffOptions
object:eslint.config.tsimport {
sheriff,
type SheriffSettings,
tseslint,
} from 'eslint-config-sheriff';
const sheriffOptions: SheriffSettings = {
react: false,
next: false,
astro: false,
lodash: false,
remeda: false,
playwright: false,
jest: false,
vitest: false,
};
export default tseslint.config(sheriff(sheriffOptions));
-
-
Configure Sheriff (optional)
-
Set up Prettier (optional)
-
Setup VS Code support (optional)
Sheriff is based on the new βflatβ ESLint config format. You cannot extend Sheriff from an old config format, it wouldnβt work.