eslint-find-rules
raw JSON → 5.0.0 verified Sat Apr 25 auth: no javascript
ESLint utility (v5.0.0, released Dec 2024) that finds built-in and plugin rules missing from your custom ESLint config. Supports both legacy (.eslintrc) and flat config (eslint.config.js). Offers options to list all available rules, current rules, deprecated rules, plugin-specific rules, and unused rules. Actively maintained with support for ESLint v8.57+ and v9.18+. Compatible with Node >=18.20. Differentiators: CLI-first, zero-config for simple use, explicit flag for flat config, and options to include/exclude deprecated or core rules.
Common errors
error Error: Cannot find module 'eslint' ↓
cause eslint not installed or not in node_modules
fix
npm install eslint --save-dev
error Error: ESLint configuration is invalid ↓
cause Provided config file has syntax errors or is not a valid ESLint config
fix
Check the config file for errors, ensure it exports a valid config object
error Error: Unknown option '--flatConfig' ↓
cause Using an older version (<4.2.0) of eslint-find-rules that doesn't support flat config
fix
Upgrade eslint-find-rules to v4.2.0+ with npm install eslint-find-rules@latest
error Error: Process exited with code 1 (no error message) ↓
cause Deprecated or unused rules found; tool exits with non-zero by default
fix
Add -n/--no-error flag if you want to suppress exit code
Warnings
breaking Requires Node >= 18.20 and ESLint >= 8.57.1 ↓
fix Upgrade Node to 18.20+ and ESLint to 8.57.1+ or 9.18+
deprecated Support for ESLint < 8.57.1 dropped in v5 ↓
fix Pin to eslint-find-rules@4.x if using older ESLint
breaking Support for ESLint < 7 dropped in v4.0.0 ↓
fix Use ESLint >= 7 or stick to v3.x
gotcha Using globally installed eslint-find-rules will fail if ESLint and plugins are not also global ↓
fix Install eslint-find-rules as a devDependency and run via npm script
gotcha By default, deprecated rules are omitted from --all-available, --plugin, and --unused output ↓
fix Add --include deprecated or -i deprecated flag to include deprecated rules
breaking Flat config support requires --flatConfig flag; without it, legacy mode is assumed ↓
fix Add --flatConfig to the command when using eslint.config.js
Install
npm install eslint-find-rules yarn add eslint-find-rules pnpm add eslint-find-rules Imports
- cli
npx eslint-find-rules --unused .eslintrc.js - programmatic API
const { findRules } = require('eslint-find-rules'); - module
import { findRules } from 'eslint-find-rules';
Quickstart
// package.json
{
"scripts": {
"find-unused": "eslint-find-rules --unused .eslintrc.js"
},
"devDependencies": {
"eslint-find-rules": "^5.0.0"
}
}
// Then run:
// npm run find-unused
// For flat config:
// eslint-find-rules --unused eslint.config.js --flatConfig
// All available options:
// eslint-find-rules --all-available .eslintrc.js
// eslint-find-rules --current .eslintrc.js
// eslint-find-rules --deprecated .eslintrc.js
// eslint-find-rules --plugin .eslintrc.js