nuxt / eslint

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

Conflicts with eslint-plugin-import #509

Closed alexcroox closed 3 weeks ago

alexcroox commented 1 month ago

Environment


Package

None

Reproduction

import importPlugin from 'eslint-plugin-import'
import withNuxt from './.nuxt/eslint.config.mjs'

export default withNuxt({
  importPlugin.flatConfigs.recommended,
})

Describe the bug

I'm trying to use eslint-plugin-import (https://github.com/import-js/eslint-plugin-import) and I get the error:

Error: ESLintFlatConfigUtils: Different instances of plugin "import" found in multiple configs:
nuxt/import/rules, import/recommended.

This is because import plugin is already used here (totally undocumented btw) https://github.com/nuxt/eslint/blob/main/packages/eslint-config/src/flat/configs/import.ts

I'd rather use the eslint-plugin-import plugin because:

Can I suggest we switch to eslint-plugin-import which is maintained?

Additional context

No response

Logs

No response

Gypsophyllite commented 3 weeks ago

Same issue, I don't want to disable standalone and config a lot.🧐

antfu commented 3 weeks ago

You are linking to the wrong repo: https://github.com/un-ts/eslint-plugin-import-x which is a modern and more active version to eslint-plugin-import

You can always disable import/order explicitly if you don't want it.

I'd say eslint-plugin-import-x is designed to replace eslint-plugin-import, which I don't see the point to use the old one as the modern one is already included by Nuxt ESLint. Of course, you can do some hacks to the config array to completely remove that - or I would suggest using the standalone mode if you really don't agree with Nuxt's default (which is totally fine). I would consider this issue out-of-scope. Thanks.

alexcroox commented 3 weeks ago

Thanks, that makes sense, I hadn't noticed the repo it was forked from. I was able to enable the import/order without enabling stylistic by adding it to my own config:

'import/order': 'error'