LogoSheriff
Documentation/Setup

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
pnpm add -D eslint eslint-config-sheriff
yarn add --dev 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 snippet of code:

eslint.config.mjs
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:

eslint.config.mjs
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:

  1. make sure your installed ESLint version is >=9.9.0 (preferably >=9.18.0. See why)
  2. install jiti
npm install -D jiti
pnpm add -D jiti
yarn add --dev jiti
bun add --dev jiti
  1. change the extension of eslint.config.mjs from .mjs to .ts
  2. define the types of the sheriffOptions object:
eslint.config.ts
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));

Setup Prettier (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