ESLint config hudochenkov
raw JSON → 13.0.0 verified Mon Apr 27 auth: no javascript
A shared ESLint flat config package by hudochenkov, providing preset configurations for JavaScript, React, React Testing Library, and Jest. Current stable version 13.0.0 requires ESLint ^9.30.0, Node.js >=20, and runs as ESM only. It is released actively, following ESLint and plugin updates. Key differentiators: it is opinionated but modular, allowing selective use of `main`, `react`, `reactTesting`, and `jest` configs; it migrated to flat config in v10 and dropped CommonJS support; peer dependencies are extensive, and users must install them manually. This config enforces modern rules from `@stylistic/eslint-plugin`, `eslint-plugin-unicorn`, and `eslint-plugin-import`, and disables `import/no-unresolved`.
Common errors
error Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/eslint-config-hudochenkov/index.js from /path/to/eslint.config.js not supported. ↓
cause Using require() on an ESM-only package.
fix
Use import syntax or set "type": "module" in package.json.
error Cannot find module '@stylistic/eslint-plugin' ↓
cause Missing peer dependency @stylistic/eslint-plugin.
fix
Run: npm install --save-dev @stylistic/eslint-plugin
error Configuration for rule "import/no-unresolved" is invalid: Value "off" is not valid. ↓
cause Rule 'import/no-unresolved' is disabled in this config but user may have enabled it.
fix
Remove or override that rule if needed; it is explicitly disabled by the config.
Warnings
breaking Package is ESM-only since v10.0.0. Using require() will cause a MODULE_NOT_FOUND error. ↓
fix Switch to import syntax and set "type": "module" in package.json.
breaking v12.0.0 replaced deprecated stylistic rules with @stylistic/eslint-plugin and removed remaining deprecated rules. Old configs referencing removed rules fail. ↓
fix Update to @stylistic/eslint-plugin rules; see changelog.
breaking v11.0.0 migrated to ESLint v9. Peer dependencies must satisfy ESLint ^9.30.0. ↓
fix Upgrade ESLint to v9.x.
breaking v12.0.0 removed Jest rules from 'commonPlugins' and 'main' configs into a separate 'jest' config. Those relying on Jest rules in main get errors. ↓
fix Add configs.jest to your configuration if you need Jest rules.
deprecated v10.0.0 dropped CommonJS support and migrated to flat config. Old .eslintrc files are not compatible. ↓
fix Use eslint.config.js with flat config. See https://eslint.org/docs/latest/use/configure/configuration-files-new
gotcha All peer dependencies must be installed manually; they are not auto-installed by npm. Missing peer deps cause runtime errors. ↓
fix Install all peer deps listed in package.json manually.
gotcha Since v11, ESLint v9 is required, which does not support .eslintrc* files. Using this config with an older ESLint version fails. ↓
fix Use ESLint >=9.30.0.
Install
npm install eslint-config-hudochenkov yarn add eslint-config-hudochenkov pnpm add eslint-config-hudochenkov Imports
- configs wrong
const { configs } = require('eslint-config-hudochenkov')correctimport { configs } from 'eslint-config-hudochenkov' - configs.main wrong
import main from 'eslint-config-hudochenkov'correctimport { configs } from 'eslint-config-hudochenkov'; configs.main - configs.react wrong
import { react } from 'eslint-config-hudochenkov'correctimport { configs } from 'eslint-config-hudochenkov'; configs.react
Quickstart
// eslint.config.js
import { configs } from 'eslint-config-hudochenkov';
import { defineConfig } from 'eslint/config';
export default defineConfig([
configs.main,
configs.react,
{
rules: {
'no-console': 'warn',
},
},
]);