nuxt / eslint

Collection of ESLint-related packages for Nuxt
https://eslint.nuxt.com
MIT License
556 stars 66 forks source link

Config error when using custom config presets #390

Closed dbarjs closed 7 months ago

dbarjs commented 7 months ago

Environment

Package

@nuxt/eslint-module

Reproduction

StackBlitz: https://stackblitz.com/~/github.com/dbarjs/nuxt-eslint-plugin-import-issue Repo: https://github.com/dbarjs/nuxt-eslint-plugin-import-issue

Describe the bug

Similar error of #389, but now the error happens with the import plugin.

When running eslint .:

➜ nr lint

> lint
> eslint .

Oops! Something went wrong! :(

ESLint: 9.0.0

ConfigError: Config "antfu/imports/rules": Key "plugins": Cannot redefine plugin "import".
    at rethrowConfigError (/workspaces/nuxt-eslint-plugin-import-issue/node_modules/@humanwhocodes/config-array/api.js:225:8)
    at /workspaces/nuxt-eslint-plugin-import-issue/node_modules/@humanwhocodes/config-array/api.js:1018:5
    at Array.reduce (<anonymous>)
    at FlatConfigArray.getConfig (/workspaces/nuxt-eslint-plugin-import-issue/node_modules/@humanwhocodes/config-array/api.js:1014:39)
    at FlatConfigArray.isFileIgnored (/workspaces/nuxt-eslint-plugin-import-issue/node_modules/@humanwhocodes/config-array/api.js:1046:15)
    at /workspaces/nuxt-eslint-plugin-import-issue/node_modules/eslint/lib/eslint/eslint-helpers.js:322:49
    at Array.reduce (<anonymous>)
    at entryFilter (/workspaces/nuxt-eslint-plugin-import-issue/node_modules/eslint/lib/eslint/eslint-helpers.js:309:28)
    at Object.isAppliedFilter (/workspaces/nuxt-eslint-plugin-import-issue/node_modules/@nodelib/fs.walk/out/readers/common.js:12:31)
    at AsyncReader._handleEntry (/workspaces/nuxt-eslint-plugin-import-issue/node_modules/@nodelib/fs.walk/out/readers/async.js:86:20)

Additional context

I'm already using the new versions:

"@antfu/eslint-config": "^2.13.3",
"@nuxt/eslint": "^0.3.5",
"eslint": "^9.0.0"

Logs

ESLint extension for VS Code output:

[Error - 4:21:00 PM] An unexpected error occurred:
[Error - 4:21:00 PM] ConfigError: Config "antfu/imports/rules": Key "plugins": Cannot redefine plugin "import".
    at rethrowConfigError (/workspaces/nuxt-eslint-plugin-import-issue/node_modules/@humanwhocodes/config-array/api.js:225:8)
    at /workspaces/nuxt-eslint-plugin-import-issue/node_modules/@humanwhocodes/config-array/api.js:1018:5
    at Array.reduce (<anonymous>)
    at FlatConfigArray.getConfig (/workspaces/nuxt-eslint-plugin-import-issue/node_modules/@humanwhocodes/config-array/api.js:1014:39)
    at ESLint.calculateConfigForFile (/workspaces/nuxt-eslint-plugin-import-issue/node_modules/eslint/lib/eslint/eslint.js:1175:24)
    at async ESLint.isPathIgnored (/workspaces/nuxt-eslint-plugin-import-issue/node_modules/eslint/lib/eslint/eslint.js:1197:24)
    at async ESLint.lintText (/workspaces/nuxt-eslint-plugin-import-issue/node_modules/eslint/lib/eslint/eslint.js:1034:33)
    at async /home/node/.vscode-server/extensions/dbaeumer.vscode-eslint-2.4.4/server/out/eslintServer.js:1:24954
    at async E (/home/node/.vscode-server/extensions/dbaeumer.vscode-eslint-2.4.4/server/out/eslintServer.js:1:19114)
    at async /home/node/.vscode-server/extensions/dbaeumer.vscode-eslint-2.4.4/server/out/eslintServer.js:1:220290
antfu commented 7 months ago

a6092f81f08817f580922d5682d760dca5bcae28 should fix it

dbarjs commented 7 months ago

@antfu the error still persists after upgrading the @nuxt/eslint to v0.3.6.

antfu commented 7 months ago

You forget to disable standalone: https://eslint.nuxt.com/packages/module#custom-config-presets