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

Support ESLint 9 #183

Open
fisker opened this issue Jan 4, 2024 · 14 comments · May be fixed by #186
Open

Support ESLint 9 #183

fisker opened this issue Jan 4, 2024 · 14 comments · May be fixed by #186
Assignees

Comments

@fisker
Copy link

fisker commented Jan 4, 2024

ESLint v9.0.0-alpha.0 released

@JoshuaKGoldberg
Copy link

🤔 #186 mostly just has test file changes. Does that imply eslint-utils already supports ESLint 9?

cc @voxpelli from eslint/eslint#18093 (comment)

@fisker
Copy link
Author

fisker commented Mar 10, 2024

No, can't be installed without --legacy-peer-deps, it's blocking unicorn https://github.com/sindresorhus/eslint-plugin-unicorn/actions/runs/8019879716/job/21908544750?pr=2250#step:4:14

@voxpelli
Copy link
Member

No, can't be installed without --legacy-peer-deps, it's blocking unicorn

I guess that's because >=8.0.0 doesn't match prereleases, which makes little sense for peer dependencies, but since it's easier to change here than to change npm I guess we could update it to say:

^8.0.0 || >=9.0.0-beta.2

That should fix it, right?

@voxpelli
Copy link
Member

One thing I don't get about version ranges and npm is that when I try it on https://semver.npmjs.com/ I get this:

>=9.0.0-0: 9.0.0-alpha.0, 9.0.0-alpha.1, 9.0.0-alpha.2, 9.0.0-beta.0, 9.0.0-beta.1, 9.0.0-beta.2
^8.0.0 || >=9.0.0-0: no 9.x versions at all 🤔

I wonder if that's a bug with semver.npmjs.com or with semver in itself – I will investigate.


This is a similar issue as in eslint-community/eslint-plugin-n#197 – that >=8.0.0 doesn't include prereleases of new versions is quite a challenge. Might be that we should always do the >= on the earliest next major version pre-release rather than on the current stable major release

@voxpelli
Copy link
Member

voxpelli commented Mar 10, 2024

I tested using the semver module itself:

import { satisfies, compare } from 'semver';

console.log(satisfies('8.2.3',         '^8.0.0 || >=9.0.0-0')); // true
console.log(satisfies('9.0.0-beta.2',  '^8.0.0 || >=9.0.0-0')); // true
console.log(satisfies('9.2.3',         '^8.0.0 || >=9.0.0-0')); // true
console.log(satisfies('9.2.3-beta.2',  '^8.0.0 || >=9.0.0-0')); // false
console.log(satisfies('10.0.0-beta.2', '^8.0.0 || >=9.0.0-0')); // false
console.log(satisfies('10.0.0',        '^8.0.0 || >=9.0.0-0')); // true

console.log('');

console.log(satisfies('9.0.0-beta.2',  '>=8.0.0', { includePrerelease: true })); // true
console.log(satisfies('9.2.3-beta.2',  '>=8.0.0', { includePrerelease: true })); // true
console.log(satisfies('10.0.0-beta.2', '>=8.0.0', { includePrerelease: true })); // true

// [ '9.0.0-0', '9.0.0--', '9.0.0-a', '9.0.0-beta.2' ]
console.log(['9.0.0--', '9.0.0-0', '9.0.0-a', '9.0.0-beta.2'].sort(compare));

This shows:

  • ^8.0.0 || >=9.0.0-0 will work for all pre-releases of 9.0.0 + all stable versions of 9.x
  • ^8.0.0 || >=9.0.0-0 will not work for any pre-releases of versions later than 9.0.0 – eg. neither 9.2.3-beta.2 nor '10.0.0-beta.2'
  • x.y.z-0 is the earliest possible pre-release of any version, so setting that as the lower limit is the same as saying "all pre-releases"

I'll open a PR

@voxpelli
Copy link
Member

Found a relevant RFC: npm/rfcs#397

@harryzcy
Copy link

harryzcy commented Apr 5, 2024

It looks like ESLint 9 is released, so matching pre-releases is no longer necessary.

@barbalex
Copy link

barbalex commented Apr 7, 2024

It seems it does not work though?
I am using:

"eslint": "9.0.0",

And getting:

√ Run npm install to install new versions? ... yes
Installing dependencies...
npm ERR! 
code ERESOLVE

npm ERR!
 ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @typescript-eslint/[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!   peer eslint@"^6.0.0 || ^7.0.0 || >=8.0.0" from @eslint-community/[email protected]
npm ERR!   node_modules/@eslint-community/eslint-utils
npm ERR!     @eslint-community/eslint-utils@"^4.4.0" from @typescript-eslint/[email protected]
npm ERR!     node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/utils
npm ERR!       @typescript-eslint/utils@"7.5.0" from @typescript-eslint/[email protected]
npm ERR!       node_modules/@typescript-eslint/eslint-plugin
npm ERR!         dev @typescript-eslint/eslint-plugin@"7.5.0" from the root project
npm
ERR!       1 more (@typescript-eslint/type-utils)
npm ERR!     @eslint-community/eslint-utils@"^4.2.0" from [email protected]
npm ERR!   1 more (eslint-plugin-react-refresh)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint@"^8.56.0" from @typescript-eslint/[email protected]
npm ERR! node_modules/@typescript-eslint/eslint-plugin
npm ERR!   dev @typescript-eslint/eslint-plugin@"7.5.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/eslint
npm ERR!   peer eslint@"^8.56.0" from @typescript-eslint/[email protected]
npm ERR!   node_modules/@typescript-eslint/eslint-plugin
npm ERR!     dev @typescript-eslint/eslint-plugin@"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 ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! C:\Users\alexa\AppData\Local\npm-cache\_logs\2024-04-07T08_45_30_389Z-eresolve-report.txt


npm ERR! A complete log of this run can be found in: C:\Users\alexa\AppData\Local\npm-cache\_logs\2024-04-07T08_45_30_389Z-debug-0.log

Error: npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @typescript-eslint/[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!   peer eslint@"^6.0.0 || ^7.0.0 || >=8.0.0" from @eslint-community/[email protected]
npm ERR!   node_modules/@eslint-community/eslint-utils
npm ERR!     @eslint-community/eslint-utils@"^4.4.0" from @typescript-eslint/[email protected]
npm ERR!     node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/utils
npm ERR!       @typescript-eslint/utils@"7.5.0" from @typescript-eslint/[email protected]
npm ERR!       node_modules/@typescript-eslint/eslint-plugin
npm ERR!         dev @typescript-eslint/eslint-plugin@"7.5.0" from the root project
npm ERR!       1 more (@typescript-eslint/type-utils)
npm ERR!     @eslint-community/eslint-utils@"^4.2.0" from [email protected]
npm ERR!   1 more (eslint-plugin-react-refresh)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint@"^8.56.0" from @typescript-eslint/[email protected]
npm ERR! node_modules/@typescript-eslint/eslint-plugin
npm ERR!   dev @typescript-eslint/eslint-plugin@"7.5.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/eslint
npm ERR!   peer eslint@"^8.56.0" from @typescript-eslint/[email protected]
npm ERR!   node_modules/@typescript-eslint/eslint-plugin
npm ERR!     dev @typescript-eslint/eslint-plugin@"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 ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! C:\Users\alexa\AppData\Local\npm-cache\_logs\2024-04-07T08_45_30_389Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: C:\Users\alexa\AppData\Local\npm-cache\_logs\2024-04-07T08_45_30_389Z-debug-0.log

    at C:\Users\alexa\AppData\Roaming\nvm\v21.1.0\node_modules\npm-check-updates\build\src\index.js:178:23
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

@voxpelli
Copy link
Member

voxpelli commented Apr 7, 2024

@barbalex I believe that error is caused by @typescript-eslint/eslint-plugin not allowing eslint 9

@JoshuaKGoldberg
Copy link

For reference: typescript-eslint/typescript-eslint#8211

We're a little behind over on typescript-eslint but we're working on it. Hoping to get the support out soon. ❤️

@Edivion
Copy link

Edivion commented May 24, 2024

Hi @JoshuaKGoldberg / @voxpelli, any update on the support for this?

@sacru2red
Copy link

ping
Because of this issue, I won't be able to upgrade to eslint@9 for several months.

#206 doesn't seem to need to be merged.
As for #186, I think you only need to change the peerDependency in package.json after merging, right?

@voxpelli
Copy link
Member

@sacru2red How is it blocking? Isn't even ESLint 9 itself shipping with this module?

@sacru2red
Copy link

@voxpelli
Opps. I saw simiar logs #183 (comment)
I checked again and found that @typescript-eslint/parser was causing the problem.
Thanks..

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