mizdra / eslint-interactive

The CLI tool to fix huge number of ESLint errors
MIT License
363 stars 9 forks source link

Error [ConfigError]: Config (unnamed): Key "language" on convertErrorToWarningPerFile #360

Closed danielpza closed 1 month ago

danielpza commented 2 months ago

When choosing the option to convert the error to warning per file it crashes:

✔ Which rules would you like to apply action? · @typescript-eslint/no-explicit-any
✔ Which action do you want to do? · convertErrorToWarningPerFile
✔ Leave a code comment with your reason for fixing (Optional) · 
✖ Fixing...
Error [ConfigError]: Config (unnamed): Key "language": Expected string in the form "pluginName/objectName" but found "[object Object]".
    at rethrowConfigError (/home/daniel/projects/typescript-transform-paths/node_modules/@eslint/config-array/dist/cjs/index.cjs:303:8)
    at /home/daniel/projects/typescript-transform-paths/node_modules/@eslint/config-array/dist/cjs/index.cjs:1098:5
    at Array.reduce (<anonymous>)
    at FlatConfigArray.getConfigWithStatus (/home/daniel/projects/typescript-transform-paths/node_modules/@eslint/config-array/dist/cjs/index.cjs:1091:43)
    at FlatConfigArray.getConfig (/home/daniel/projects/typescript-transform-paths/node_modules/@eslint/config-array/dist/cjs/index.cjs:1120:15)
    at Linter._verifyWithFlatConfigArray (/home/daniel/projects/typescript-transform-paths/node_modules/eslint/lib/linter/linter.js:2052:36)
    at Linter.verify (/home/daniel/projects/typescript-transform-paths/node_modules/eslint/lib/linter/linter.js:1547:61)
    at verifyAndFix (/home/daniel/projects/typescript-transform-paths/node_modules/eslint-interactive/src/eslint/linter.ts:53:8)
    at Core.fix (/home/daniel/projects/typescript-transform-paths/node_modules/eslint-interactive/src/core.ts:207:27)
    at SerializableCore.convertErrorToWarningPerFile (/home/daniel/projects/typescript-transform-paths/node_modules/eslint-interactive/src/core-worker.ts:47:18)
❯ yarn eslint --version
v9.8.0
❯ yarn eslint-interactive --version
11.0.2

The other options seem to be working fine so far.

btw thanks for this awesome package. I've used it in some large scale codebases and it has been a huge time saver.

mizdra commented 2 months ago

Can you provide a minimal repository that reproduces the problem? Without it, we cannot investigate.

danielpza commented 2 months ago

Hey @mizdra, thanks for the quick reponse.

If it helps although not minimal this is where I got the error https://github.com/LeDDGroup/typescript-transform-paths/compare/fix-eslint

I'll check again and try to make a minimal reproduction

tamasfabi commented 2 months ago

I did encounter the same error message on my private pnpm monorepo too (with flatconfig for eslint), when using with these packages:

"@eslint/compat": "^1.1.1",
"@eslint/js": "^9.8.0",
"@typescript-eslint/parser": "^8.0.1",
"eslint": "^9.8.0",
"eslint-config-prettier": "^9.1.0",
"eslint-interactive": "^11.0.2",
"eslint-plugin-jsx-a11y": "^6.9.0",
"eslint-plugin-react": "^7.35.0",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-simple-import-sort": "^12.1.1",

Added a console.log to the sourcecode before the error happens, to log the configArray object that has the "wrong" language set, this might be handy. @mizdra

Screenshot 2024-08-15 at 12 30 05
nocive commented 2 months ago

Facing the same error while using eslint flat config.

mizdra commented 1 month ago

@danielpza Thanks for providing your repository! I could reproduce the issue. I will fix it.

mizdra commented 1 month ago

This problem seems to occur with ESLint 9.5.0+. It is not reproduced in 9.4.0 or lower.

minimum reproduction: https://github.com/mizdra/typescript-transform-paths/tree/minimum-reproduction

danielpza commented 1 month ago

Sorry, I couldn't provide a minimal repo, I got distracted with work.

Thanks for taking a look @mizdra :heart:.

mizdra commented 1 month ago

@danielpza, @tamasfabi This bug fix is shipped in v11.0.3. Thanks for contributing!

nocive commented 1 month ago

Can also confirm that it's fixed, thanks :heart: