Skip to content
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

Update peer dependencies to include @typescript-eslint/parser v6 #13

Closed
SuperKXT opened this issue Jul 12, 2023 · 11 comments · Fixed by #14
Closed

Update peer dependencies to include @typescript-eslint/parser v6 #13

SuperKXT opened this issue Jul 12, 2023 · 11 comments · Fixed by #14

Comments

@SuperKXT
Copy link

Typescript-eslint just released v6. I'm getting a peer dependency mismatch warning after updating.

@bcentdev
Copy link

Hello, @hluisson , please :) 🔝

@karlhorky
Copy link
Contributor

Here's the warning that appears (with pnpm):

$ pnpm install
 WARN  Issues with peer dependencies found
.
└─┬ eslint-plugin-jsx-expressions 1.3.1
  └── ✕ unmet peer @typescript-eslint/parser@"^4.0.0 || ^5.0.0": found 6.2.1

@karlhorky
Copy link
Contributor

karlhorky commented Sep 5, 2023

And this actually causes a failure with npm when running npm install in a project that uses @typescript-eslint/*@^6.0.0 packages, since npm is a bit more picky with peer dependencies:

$ npm i
npm notice 
npm notice New major version of npm available! 8.19.2 -> 10.0.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.0.0
npm notice Run npm install -g [email protected] to update!
npm notice 
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: @typescript-eslint/[email protected]
npm ERR! node_modules/@typescript-eslint/parser
npm ERR!   peer @typescript-eslint/parser@"^6.3.0" from [email protected]
npm ERR!   node_modules/eslint-config-upleveled
npm ERR!     dev eslint-config-upleveled@"^5.0.4" from the root project
npm ERR!   peer @typescript-eslint/parser@"^6.0.0 || ^6.0.0-alpha" from @typescript-eslint/[email protected]
npm ERR!   node_modules/@typescript-eslint/eslint-plugin
npm ERR!     peer @typescript-eslint/eslint-plugin@"^6.3.0" from [email protected]
npm ERR!     node_modules/eslint-config-upleveled
npm ERR!       dev eslint-config-upleveled@"^5.0.4" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @typescript-eslint/parser@"^4.0.0 || ^5.0.0" from [email protected]
npm ERR! node_modules/eslint-plugin-jsx-expressions
npm ERR!   peer eslint-plugin-jsx-expressions@"^1.3.1" from [email protected]
npm ERR!   node_modules/eslint-config-upleveled
npm ERR!     dev eslint-config-upleveled@"^5.0.4" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: @typescript-eslint/[email protected]
npm ERR! node_modules/@typescript-eslint/parser
npm ERR!   peer @typescript-eslint/parser@"^4.0.0 || ^5.0.0" from [email protected]
npm ERR!   node_modules/eslint-plugin-jsx-expressions
npm ERR!     peer eslint-plugin-jsx-expressions@"^1.3.1" from [email protected]
npm ERR!     node_modules/eslint-config-upleveled
npm ERR!       dev eslint-config-upleveled@"^5.0.4" 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 ERR! 
npm ERR! See /home/runner/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2023-09-05T11_35_09_217Z-debug-0.log

@karlhorky
Copy link
Contributor

karlhorky commented Sep 5, 2023

@hluisson would you be open to upgrading the peer dependency on @typescript-eslint/parser@^6?

It may also need a switch away from the @typescript-eslint/experimental-utils package to @typescript-eslint/utils, used here:

"dependencies": {
"@typescript-eslint/experimental-utils": "^5.5.0",
"tsutils": "^3.21.0"
},

@hluisson
Copy link
Owner

hluisson commented Sep 5, 2023

Hey - this is on my radar, but for fastest resolution feel free to submit a PR!

@DerTimonius
Copy link

I'm currently looking into it and noticed the following:

  • upgrading not only the peer dependency, but also the dev dependency for @typescript-eslint/parser to ^6 (which I guess would be necessary if the peer dependency is updated) only works if the switch from the @typescript-eslint/experimental-utils package to @typescript-eslint/utils is made as @karlhorky mentioned
  • this leads to issues, since RuleTester is now a separate package
    • if this is imported together with the utils package, I can't get the tests to run locally:
Test suite failed to run
    Cannot find module '@typescript-eslint/utils/eslint-utils' from 'node_modules/@typescript-eslint/rule-tester/dist/RuleTester.js'
    Require stack:
      node_modules/@typescript-eslint/rule-tester/dist/RuleTester.js
      node_modules/@typescript-eslint/rule-tester/dist/index.js
      tests/lib/rules/strict-logical-expressions.test.ts

Another thing I noticed was that a change to the tsconfig.build.json (switching from node to node16 or similar in the moduleResolution) would have to be made according to this issue

@stianjensen
Copy link

I recently tackled upgrading this with what seems like mostly similar issues here:
gund/eslint-plugin-deprecation#71

You can look at that for inspiration, otherwise I might get around to making a similar PR here as well soon!

@karlhorky
Copy link
Contributor

Workaround

Until this is fixed, you can override the dependencies to the latest version:

Eg using npm Overrides:

package.json

{
  "overrides": {
    "@typescript-eslint/eslint-plugin": "6.9.1",
    "@typescript-eslint/parser": "6.9.1"
  }
}

(or Yarn Resolutions or pnpm Overrides)

@hluisson
Copy link
Owner

Hey all - thanks for your patience. I will publish 1.3.2 as soon as possible.

@hluisson
Copy link
Owner

1.3.2 is now live!

@karlhorky
Copy link
Contributor

karlhorky commented Nov 19, 2023

@hluisson Thanks so much, I can confirm this is working now, no more peer dependency warnings 🙌

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

Successfully merging a pull request may close this issue.

6 participants