Skip to content

[Bug?]: Duplicated same-version packages in node_modules but not in yarn.lock #6458

@valeriangalliat

Description

@valeriangalliat

Self-service

  • I'd be willing to implement a fix

Describe the bug

When installing eslint-config-next, eslint-plugin-import and @typescript-eslint/parser at the same time, eslint-plugin-import is duplicated inside node_modules:

node_modules/eslint-plugin-import
node_modules/eslint-config-next/node_modules/eslint-plugin-import

Despite the same version being installed in both:

$ yarn why eslint-plugin-import
├─ eslint-config-next@npm:14.2.5
│  └─ eslint-plugin-import@npm:2.29.1 (via npm:^2.28.1)

├─ eslint-config-next@npm:14.2.5 [ee419]
│  └─ eslint-plugin-import@npm:2.29.1 [ac8eb] (via npm:^2.28.1 [ac8eb])

└─ yarn-debug@workspace:.
   └─ eslint-plugin-import@npm:2.29.1 [ee419] (via npm:^2.29.1 [ee419])

$ yarn why -R eslint-plugin-import
└─ yarn-debug@workspace:.
   ├─ eslint-config-next@npm:14.2.5 [ee419] (via npm:^14.2.5 [ee419])
   │  └─ eslint-plugin-import@npm:2.29.1 [ac8eb] (via npm:^2.28.1 [ac8eb])
   └─ eslint-plugin-import@npm:2.29.1 [ee419] (via npm:^2.29.1 [ee419])

This does not happen if @typescript-eslint/parser is not installed. Without @typescript-eslint/parser, there's only one instance of eslint-plugin-import in node_modules/eslint-plugin-import.


ESLint issue that can result from this duplication:

ESLint couldn't determine the plugin "import" uniquely.

- node_modules/eslint-config-next/node_modules/eslint-plugin-import/lib/index.js (loaded in ".eslintrc.js » eslint-config-next/core-web-vitals » node_modules/eslint-config-next/index.js")
- node_modules/eslint-plugin-import/lib/index.js (loaded in ".eslintrc.js")

Please remove the "plugins" setting from either config or remove either plugin installation.

Related: #4128

To reproduce

yarn init -2
yarn add eslint-config-next eslint-plugin-import @typescript-eslint/parser

Environment

System:
    OS: macOS 14.5
    CPU: (10) arm64 Apple M1 Pro
  Binaries:
    Node: 18.20.3
    Yarn: 4.4.0
    npm: 10.7.0

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingupholdedReal issues without formal reproduction

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions