Skip to content

ESLint + Typescript results in dependency errors since v9.0.0 inclusion on svelte@latest #12105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
danxcraig opened this issue Apr 11, 2024 · 6 comments · Fixed by #12124
Closed

Comments

@danxcraig
Copy link

Describe the bug

When using TypeScript syntax and ESLint with svelte@latest, dependencies cannot be resolved.

Reproduction

npm create svelte@latest example-project

  • Skeleton project
  • Yes, using TypeScript syntax
  • Add ESLint
    cd example-project
    npm install

Logs

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/eslint
npm ERR!   dev eslint@"^9.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint@"^8.56.0" from [email protected]
npm ERR! node_modules/typescript-eslint
npm ERR!   dev typescript-eslint@"^7.5.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.


# npm resolution error report

While resolving: [email protected]
Found: [email protected]
node_modules/eslint
  dev eslint@"^9.0.0" from the root project

Could not resolve dependency:
peer eslint@"^8.56.0" from [email protected]
node_modules/typescript-eslint
  dev typescript-eslint@"^7.5.0" from the root project

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (8) x64 Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
    Memory: 21.00 GB / 31.92 GB
  Binaries:
    Node: 20.11.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.2.4 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 123.0.6312.107
    Edge: Chromium (123.0.2420.81)
    Internet Explorer: 11.0.19041.3636

Severity

blocking an upgrade

Additional Information

No response

@dustsucker
Copy link

I have the same issue, seems to be a major bug.

@DevLeoko
Copy link

DevLeoko commented Apr 11, 2024

This issue seems to have been introduced in #12089
typescript-eslint does not yet support ESLint v9 ( typescript-eslint/typescript-eslint#8211 )

When running npm create svelte@latest and selecting both ESLint and typescript it currently adds both ESLint v9 and typescript-eslint as a dependency causing the conflict
https://github.com/sveltejs/kit/blob/main/packages/create-svelte/shared/%2Beslint%2Btypescript/package.json
https://github.com/sveltejs/kit/blob/main/packages/create-svelte/shared/%2Beslint/package.json

Anyone looking for a quick workaround you can either manually downgrade eslint to ^8.56.0 or use the last working version of svelte-create npm create [email protected] my-app

@benmccann
Copy link
Member

Ah, it seems we may have upgraded too early. Despite the version warnings and the libraries not being officially compatible it should still work: typescript-eslint/typescript-eslint#8211 (comment)

I wonder how long it will take for a new version to roll out though and if we need to rollback in the meantime 🤔

@benmccann
Copy link
Member

benmccann commented Apr 12, 2024

The other option would be to set legacy-peer-deps=true in .npmrc with a comment to remove it after upgrading typescript-eslint. That seems slightly dangerous though as people could miss it and leave it in their projects beyond when they should

@danxcraig
Copy link
Author

Thank you for both the temp workaround advice and subsequent quick resolve @benmccann ❤️.

@jpenna
Copy link

jpenna commented Jun 22, 2024

ts-lint v8 will support eslint v9
Until it is the main version, you have to use the alpha: typescript-eslint/typescript-eslint#8211 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants