{"id":19995,"library":"eslint-rspack-plugin","title":"eslint-rspack-plugin","description":"An ESLint plugin for Rspack, forked from eslint-webpack-plugin. Version 4.4.1 is current, with active maintenance and regular releases. It integrates ESLint into the Rspack build process, providing features like caching, config type detection (flat or eslintrc), and support for multiple file extensions. Key differentiators: automatic configType detection based on ESLint version, support for ESLint 8, 9, and 10 (peer dep ^8.0.0 || ^9.0.0 || ^10.0.0), and focused compatibility with Rspack. Alternatives: running ESLint separately via CLI or editor integration.","status":"active","version":"4.4.1","language":"javascript","source_language":"en","source_url":"https://github.com/rstackjs/eslint-rspack-plugin","tags":["javascript","eslint","lint","linter","plugin","rspack","typescript"],"install":[{"cmd":"npm install eslint-rspack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-rspack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-rspack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; the plugin uses ESLint's Node.js API.","package":"eslint","optional":false}],"imports":[{"note":"Package is ESM-only; CommonJS require() will fail in Node >=16 with ESM config. Use import or dynamic import().","wrong":"const ESLintPlugin = require('eslint-rspack-plugin');","symbol":"ESLintPlugin","correct":"import ESLintPlugin from 'eslint-rspack-plugin';"},{"note":"ESLintPluginOptions is a TypeScript type, not a runtime export; use type-only import.","wrong":"import ESLintPluginOptions from 'eslint-rspack-plugin';","symbol":"ESLintPluginOptions","correct":"import type { ESLintPluginOptions } from 'eslint-rspack-plugin';"},{"note":"Only a default export is provided; named export { ESLintPlugin } does not exist.","wrong":"import { ESLintPlugin } from 'eslint-rspack-plugin';","symbol":"default export","correct":"import ESLintPlugin from 'eslint-rspack-plugin';"}],"quickstart":{"code":"import ESLintPlugin from 'eslint-rspack-plugin';\n\nexport default {\n  plugins: [\n    new ESLintPlugin({\n      extensions: ['js', 'jsx', 'ts', 'tsx'],\n      exclude: 'node_modules',\n      cache: true,\n      eslintPath: 'eslint',\n      configType: 'flat',\n    }),\n  ],\n};","lang":"typescript","description":"Configures eslint-rspack-plugin in an Rspack config, setting file extensions, exclusion, caching, and flat config type."},"warnings":[{"fix":"Convert to ESM (set \"type\": \"module\" in package.json or use .mjs extension) and use import syntax.","message":"Plugin is ESM-only. Node.js require() will throw ERR_REQUIRE_ESM.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Explicitly set configType to match your ESLint configuration format (eslintrc or flat).","message":"The 'configType' option must match the ESLint version: use 'eslintrc' for ESLint <9, 'flat' for ESLint >=9. Autodetection may pick wrong if ESLint version is ambiguous.","severity":"gotcha","affected_versions":">=4.0.0"},{"fix":"When using flat config, specify files in ESLint configuration instead of plugin options.","message":"The 'extensions' option only works with configType: 'eslintrc'. For flat config, use ESLint's 'files' option directly.","severity":"gotcha","affected_versions":">=4.0.0"},{"fix":"Replace lintDirtyModulesOnly with lintAllFiles: true if you want to lint all files.","message":"The 'lintDirtyModulesOnly' option is deprecated and may be removed in a future version. Use 'lintAllFiles' instead.","severity":"deprecated","affected_versions":">=4.2.0"},{"fix":"Clear old cache directory if migrating from an older version, or set cacheLocation explicitly.","message":"Cache location default changed between versions. v4.4.0+ uses 'node_modules/.cache/eslint-rspack-plugin/.eslintcache'; older versions used a different path.","severity":"gotcha","affected_versions":"<4.4.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Convert your config file to ESM: rename to .mjs or add \"type\": \"module\" in package.json, then use import ESLintPlugin from 'eslint-rspack-plugin';","cause":"Using CommonJS require() to import an ESM-only package.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/eslint-rspack-plugin/dist/index.js from /path/to/rspack.config.js not supported."},{"fix":"Use default import: import ESLintPlugin from 'eslint-rspack-plugin';","cause":"Importing the default export incorrectly, e.g., using a named import.","error":"TypeError: ESLintPlugin is not a constructor"},{"fix":"Ensure your ESLint config uses numeric severity (2 for error) or correct format. For flat config, use 'error' as string is valid, but this error appears if mixing formats.","cause":"Using string severity ('error') in ESLint configuration when numeric values are expected, common with flat config without proper adapter.","error":"Configuration for rule 'some-rule' is invalid: Value \"error\" should be one of 0, 1, 2."},{"fix":"Remove 'extensions' from plugin options and configure file extensions via ESLint's 'files' option in flat config.","cause":"Setting 'extensions' option in plugin while using flat config (configType: 'flat').","error":"Error: ESLint configuration is invalid: \"extensions\" is not supported."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}