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

Relax ESLint peerDependency constraint to allow v9 #16414

Merged
merged 4 commits into from Apr 29, 2024

Conversation

liuxingbaoyu
Copy link
Member

@liuxingbaoyu liuxingbaoyu commented Apr 6, 2024

Q                       A
Fixed Issues? Fixes: #16220
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

@babel-bot
Copy link
Collaborator

babel-bot commented Apr 6, 2024

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/56756

const noInvalidThisRule = new eslint.Linter().getRules().get("no-invalid-this");
const noInvalidThisRule = (
parseInt(eslintVersion, 10) >= 9
? require("eslint/use-at-your-own-risk").builtinRules
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bricss
Copy link

bricss commented Apr 6, 2024

We need it shipped 🚢 and we need it now 🙏

Copy link
Contributor

@JLHwung JLHwung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add an ESLint 8 CI job? It will be similar to this job:

eslint7-test:

const rule = new eslint.Linter().getRules().get("semi");
const rule = new eslint.Linter({ configType: "eslintrc" })
.getRules()
.get("semi");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we need eslint/use-at-your-own-risk here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I don't know if eslint/use-at-your-own-risk exists in the old version, and I am worried about causing regression. :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I am still confused. For other rules, we guard eslint/use-at-your-own-risk with a version check:

const rule = (
  parseInt(eslintVersion, 10) >= 9
    ? require("eslint/use-at-your-own-risk").builtinRules
    : new eslint.Linter().getRules()
).get("builtin-rule-name");

But this rule "semi" is handled in another way:

const rule = new eslint.Linter({ configType: "eslintrc" })
  .getRules()
  .get("semi");

Is there any difference between semi and other builtin rules?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They should be the same, I think it was a mistake on my part, thanks for catching it!
I initially misunderstood the comment at #16414 (comment). 🤦‍♂️

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem. I am just curious if there are any caveats within the semi rule. The new changes look good to me.

@nicolo-ribaudo
Copy link
Member

Semver-minor (support a new thing!) or patch (update an internal dep, and relax the peerDep constraint since it also works with ESLint 9)?

@liuxingbaoyu
Copy link
Member Author

I tend to treat it as a patch, because it is simple and we have no other new features. The patch version is simpler and faster. :)

@@ -51,7 +51,7 @@
},
"peerDependencies": {
"@babel/eslint-parser": "^7.11.0",
"eslint": "^8.9.0"
"eslint": "^8.9.0 || ^9.0.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we drop ESLint 8 support in Babel 8? ESLint 9 should prevail at the time we release Babel 8.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw some tweets about how a large part of ESLint's ecosystem is still not compatible with ESLint 9 so many projects cannot migrate, I'd wait a bit to see how the situation evolves.

@JLHwung
Copy link
Contributor

JLHwung commented Apr 7, 2024

I am good to semi-patch. We can formally announce the ESLint 9 support in the 7.25 release post.

@nicolo-ribaudo
Copy link
Member

Actually, maybe can we first release this as a prerelease to make sure that it's we don't need to adapt anything else in our plugins and parser?

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented Apr 8, 2024

I published @babel/[email protected] and @babel/[email protected] from this PR (both tagged as next-eslint-9 on npm). Please try them out and report any problems!

@bricss
Copy link

bricss commented Apr 9, 2024

When we may expect it to get released? 👀

@nicolo-ribaudo
Copy link
Member

The prerelease is broken because I didn't publish it correctly, but I will re-publish it today.

@bricss
Copy link

bricss commented Apr 22, 2024

Does anyone know what's the ETA for it to get shipped 📦 with next semver patch? 🙄

@bneigher
Copy link

🙏

@nicolo-ribaudo
Copy link
Member

Yeah let's release this in the next patch -- it's not adding any user-facing feature.

@liuxingbaoyu liuxingbaoyu added PR: Internal 🏠 A type of pull request used for our changelog categories area: eslint labels Apr 24, 2024
@nicolo-ribaudo nicolo-ribaudo changed the title Support eslint v9 Relax ESLint peerDependency constraint to allow v9 Apr 29, 2024
@nicolo-ribaudo nicolo-ribaudo merged commit 0128984 into babel:main Apr 29, 2024
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: eslint PR: Internal 🏠 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@babel/eslint-plugin: Support ESLint 9
6 participants