plugins
plugins copied to clipboard
[@rollup/plugin-eslint] New flat config `eslint.config.js` is not recognized
- Rollup Plugin Name: @rollup/plugin-eslint
- Rollup Plugin Version: 9.0.5
- Rollup Version: 4.14.3
- Operating System (or Browser): Windows 10
- Node Version: 20.12.2
- Link to reproduction: https://replit.com/@christiankoch2/rollup-eslint-config-not-found
Expected Behavior
The plugin should recognize and work with the new flat config (default since ESLint 9.0.0) eslint.config.js
.
Actual Behavior
Running npx rollup --config
yields:
[!] (plugin eslint) Error: No ESLint configuration found in <PATH>\src.
src/handler.ts
at CascadingConfigArrayFactory._finalizeConfigArray (<PATH>\node_modules\@rollup\plugin-eslint\node_modules\@eslint\eslintrc\lib\cascading-config-array-factory.js:521:19)
at CascadingConfigArrayFactory.getConfigArrayForFile (<PATH>\node_modules\@rollup\plugin-eslint\node_modules\@eslint\eslintrc\lib\cascading-config-array-factory.js:312:21)
at CLIEngine.isPathIgnored (<PATH>\node_modules\@rollup\plugin-eslint\node_modules\eslint\lib\cli-engine\cli-engine.js:1000:18)
at ESLint.isPathIgnored (<PATH>\node_modules\@rollup\plugin-eslint\node_modules\eslint\lib\eslint\eslint.js:681:26)
at Object.transform (file:///<PATH>/node_modules/@rollup/plugin-eslint/dist/es/index.js:24:54)
at <PATH>\node_modules\rollup\dist\shared\rollup.js:989:40
Additional Information
original rollup.config.js
(no difference if other plugins are removed):
import commonjs from '@rollup/plugin-commonjs'
import typescript from 'rollup-plugin-typescript2'
import eslint from '@rollup/plugin-eslint'
import resolve from '@rollup/plugin-node-resolve'
import json from '@rollup/plugin-json'
export default {
input: 'src/handler.ts',
output: {
dir: 'dist/cjs',
format: 'cjs'
},
plugins: [
json(),
commonjs(),
resolve(),
eslint({ throwOnError: true, fix: true }),
typescript({ useTsconfigDeclarationDir: true })
]
}
Is there any workaround for this for the time being?
I use the "overrides" entry on package.json
, You have to edit it every time you update eslint
but it works. The problem is @rollup/plugin-eslint is using eslint@8, the "overrides" entry will force eslint to be whatever version you set there.
{
"overrides": {
"eslint": "^9.9.0"
}
}
Update: It works if you are using eslint@9 but with eslint@8 (with flat config) I am still getting an error.
@manferlo81 nice!
I have it like this:
"overrides": {
"@rollup/plugin-eslint": {
"eslint": "^9.9"
}
},