antfu / eslint-config

Anthony's ESLint config preset
https://eslint-config.antfu.me/
MIT License
3.48k stars 409 forks source link

npm warn ERESOLVE overriding peer dependency #529

Closed nyxb closed 3 days ago

nyxb commented 1 week ago

Describe the bug

npm warn ERESOLVE overriding peer dependency npm warn ERESOLVE overriding peer dependency npm warn While resolving: eslint-plugin-unused-imports@4.0.0 npm warn Found: @typescript-eslint/eslint-plugin@undefined npm warn node_modules/@antfu/eslint-config/node_modules/@typescript-eslint/eslint-plugin npm warn npm warn Could not resolve dependency: npm warn peerOptional @typescript-eslint/eslint-plugin@"8" from eslint-plugin-unused-imports@4.0.0 npm warn node_modules/@antfu/eslint-config/node_modules/eslint-plugin-unused-imports npm warn eslint-plugin-unused-imports@"^4.0.0" from @antfu/eslint-config@2.22.0-beta.3 npm warn node_modules/@antfu/eslint-config npm error code ETARGET npm error notarget No matching version found for @typescript-eslint/eslint-plugin@8. npm error notarget In most cases you or one of your dependencies are requesting npm error notarget a package version that doesn't exist.

npm error A complete log of this run can be found in: /Users/nyxb/.npm/_logs/2024-07-07T15_38_55_713Z-debug-0.log

Reproduction

only use the cli

System Info

System:
    OS: macOS 14.5
    CPU: (12) arm64 Apple M2 Pro
    Memory: 73.45 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.14.0 - ~/.nvm/versions/node/v20.14.0/bin/node
    Yarn: 1.22.21 - ~/.nvm/versions/node/v20.14.0/bin/yarn
    npm: 10.7.0 - ~/.nvm/versions/node/v20.14.0/bin/npm
    pnpm: 9.4.0 - ~/.asdf/shims/pnpm
    bun: 1.1.17 - /opt/homebrew/bin/bun
    Watchman: 2024.06.24.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 126.0.6478.127
    Safari: 17.5

Used Package Manager

pnpm

Validations

Contributions

GTorreil commented 1 week ago

Similar output using npm :

➜  ~ npx @antfu/eslint-config       
Need to install the following packages:
@antfu/eslint-config@2.22.0-beta.3
Ok to proceed? (y) 
npm WARN ERESOLVE overriding peer dependency
npm WARN ERESOLVE overriding peer dependency
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: eslint-plugin-unused-imports@4.0.0
npm WARN Found: peerOptional @typescript-eslint/eslint-plugin@"8" from the root project
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peerOptional @typescript-eslint/eslint-plugin@"8" from the root project
npm WARN ERESOLVE overriding peer dependency
npm ERR! code ETARGET
npm ERR! notarget No matching version found for @typescript-eslint/eslint-plugin@8.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! A complete log of this run can be found in: /Users/guillaumetorreilles/.npm/_logs/2024-07-08T14_25_06_752Z-debug-0.log
vaiil commented 1 week ago

Caused by https://github.com/sweepline/eslint-plugin-unused-imports/issues/85

Workaround:

add this to package.json

  "overrides": {
    "@typescript-eslint/eslint-plugin": "rc-v8"
  }
ThadCastl3 commented 1 week ago

Caused by sweepline/eslint-plugin-unused-imports#85

Workaround:

add this to package.json

  "overrides": {
    "@typescript-eslint/eslint-plugin": "rc-v8"
  }

tried this and get the same error using bun:

npx @antfu/eslint-config@latest
Need to install the following packages:
@antfu/eslint-config@2.22.0
Ok to proceed? (y)

> npm warn ERESOLVE overriding peer dependency
> npm warn ERESOLVE overriding peer dependency
> npm warn ERESOLVE overriding peer dependency
> npm warn While resolving: eslint-plugin-unused-imports@4.0.0
> npm warn Found: peerOptional @typescript-eslint/eslint-plugin@"8" from the root project
> npm warn
> npm warn Could not resolve dependency:
> npm warn peerOptional @typescript-eslint/eslint-plugin@"8" from the root project
> npm warn ERESOLVE overriding peer dependency
> npm error code ETARGET
> npm error notarget No matching version found for @typescript-eslint/eslint-plugin@8.
> npm error notarget In most cases you or one of your dependencies are requesting
> npm error notarget a package version that doesn't exist.
david-mears-2 commented 1 week ago

The above workaround didn't have any effect, so I'm using the previous version of antfu/eslint-config:

npm i -D @antfu/eslint-config@2.21.0

You should also fix your package.json to the version you choose, so that future attempts to run npm install don't reach for the latest version: that is, remove the caret in

"devDependencies": {
    "@antfu/eslint-config": "^2.21.0"
}
vaiil commented 6 days ago

Try to override dependency, than install @antfu/eslint-config@latest (npm i @antfu/eslint-config@latest) and run npx again

nyxb commented 6 days ago

The point of the thing is to be able to execute npx @antfu/eslint-config@latest in a new project to install everything with the cli and unfortunately this is no longer possible.