eslint-config-stylelint

raw JSON →
27.0.0 verified Sat Apr 25 auth: no javascript

Stylelint org's shareable ESLint config. Current stable version 27.0.0, released recently. This package enforces a consistent JavaScript style across Stylelint repositories. It has become a pure ESM package since v26, dropping Node <20.19.0 and ESLint 9.x support. Key differentiator: tailored for Stylelint development, includes Jest-specific config. Peer dependencies include eslint >=10.0.2 and eslint-plugin-jest >=29.15.0. The config extends @eslint/js and uses rules from @stylistic/eslint-plugin and eslint-plugin-regexp.

error Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/eslint-config-stylelint/index.js not supported.
cause Package is ESM-only since v26; require() not allowed.
fix
Replace require() with import or use dynamic import().
error Cannot find module 'eslint-config-stylelint/jest'
cause Using wrong import path or not installing eslint-plugin-jest peer dependency.
fix
Ensure eslint-plugin-jest is installed and import from 'eslint-config-stylelint/jest'.
error ConfigError: Config array must contain only flat config objects.
cause Using old eslintrc format with flat config.
fix
Export an array of flat config objects as shown in quickstart.
breaking Dropped ESLint 9.x support and Node.js <20.19.0 support.
fix Upgrade to Node >=20.19.0 and ESLint >=10.0.2.
breaking Became a pure ESM package, breaking CommonJS require.
fix Convert project to ESM or use dynamic import().
breaking Dropped ESLint 8.x and Node.js <18.18 support.
fix Upgrade to ESLint 9+ and Node >=18.18.
deprecated No-confusing-arrow rule removed in v22.
fix Formatting rules have been deprecated; use @stylistic/eslint-plugin instead.
gotcha Jest config requires a separate subpath import, not part of main config.
fix Import 'eslint-config-stylelint/jest' explicitly.
npm install eslint-config-stylelint
yarn add eslint-config-stylelint
pnpm add eslint-config-stylelint

Shows installation and usage for ESLint flat config with and without Jest support.

// Install: npm install eslint-config-stylelint eslint --save-dev
import stylelintConfig from 'eslint-config-stylelint';
import stylelintJestConfig from 'eslint-config-stylelint/jest';

export default [
  ...stylelintConfig,
  ...stylelintJestConfig,
];