eslint-config-sheriff
raw JSON → 31.3.0 verified Sat Apr 25 auth: no javascript
eslint-config-sheriff is a comprehensive and opinionated TypeScript-first ESLint configuration. Version 31.3.0 is the latest stable release, with frequent updates (minor/patch releases weekly). It integrates over 20 ESLint plugins including Prettier, Playwright, JSDoc, Lodash, SonarJS, Unicorn, React, Next.js, and Storybook. Unlike generic ESLint configs, Sheriff provides strict defaults out of the box and requires minimal setup. It ships with TypeScript types and supports ESLint 9+ flat config. Maintained actively, with a dedicated website and CLI tool for scaffolding.
Common errors
error Error: Module "eslint-config-sheriff" has been resolved to ".../node_modules/eslint-config-sheriff/index.js" but this file does not exist. ↓
cause Missing or mismatched version; package not installed correctly.
fix
Run 'npm install eslint-config-sheriff@latest' and ensure your Node.js version is >=22.21.1.
error TypeError: sheriffConfig is not a function ↓
cause Using require() on an ESM-only package or incorrect import path.
fix
Use 'import { sheriffConfig } from 'eslint-config-sheriff' and ensure your project has 'type: module' in package.json.
error Could not find a declaration file for module 'eslint-config-sheriff'. ↓
cause TypeScript is not configured to resolve ESM modules or missing @types/eslint.
fix
Add 'eslint-config-sheriff' to tsconfig.json's 'types' array or install @types/eslint.
error ESLint: Error while loading rule '@typescript-eslint/...': You have used a rule which requires parserServices to be generated. ↓
cause Missing TypeScript parser configuration for type-aware rules.
fix
Ensure your ESLint config extends the recommended setup from sheriff, or explicitly set 'parserOptions.project: true'.
Warnings
breaking Since v31.0.0, the package has been ESM-only. CommonJS require() will fail. ↓
fix Use 'import { sheriffConfig } from 'eslint-config-sheriff'' in your config file.
breaking Since v31.1.0, defineConfig must be imported from 'eslint/config' not from 'eslint-config-sheriff'. ↓
fix Replace 'import { defineConfig } from 'eslint-config-sheriff' with 'import { defineConfig } from 'eslint/config'.
breaking Since v29.1.0, the build tool changed from tsup to tsdown, potentially affecting edge cases with dual CJS/ESM support. ↓
fix Ensure your project is using ESM (type: module in package.json) as the package is ESM-only.
deprecated Using require() to load the config is deprecated since v30.0.0 and removed in v31.0.0. ↓
fix Migrate to ESM imports.
gotcha The config expects certain peer dependencies to be installed (e.g., @typescript-eslint/parser, eslint-plugin-react). ↓
fix Run 'npx install-peerdeps eslint-config-sheriff' to install missing peer deps automatically.
Install
npm install eslint-config-sheriff yarn add eslint-config-sheriff pnpm add eslint-config-sheriff Imports
- sheriffConfig wrong
const sheriffConfig = require('eslint-config-sheriff')correctimport { sheriffConfig } from 'eslint-config-sheriff' - defineConfig wrong
import { defineConfig } from 'eslint-config-sheriff'correctimport { defineConfig } from 'eslint/config'
Quickstart
// eslint.config.js
import { sheriffConfig } from 'eslint-config-sheriff';
import { defineConfig } from 'eslint/config';
export default defineConfig([
...sheriffConfig({
react: true,
next: true,
astro: false,
playwright: false,
jest: false,
vitest: false,
}),
]);