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

Add ESLint 8 support to @babel/eslint-parser #13782

Merged
merged 8 commits into from Oct 28, 2021

Conversation

nicolo-ribaudo
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo commented Sep 22, 2021

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

The parser can check the ESLint version using require("eslint/package.json") (since it's a peer dependency). However, we need an escape hatch to switch version on-the-fly during our tests.

I don't think we need any change to @babel/eslint-plugin: we could potentially make some rules no-op, but they are already effectively no-op with ESLint 8.

@nicolo-ribaudo nicolo-ribaudo added area: eslint PR: New Feature 🚀 A type of pull request used for our changelog categories labels Sep 22, 2021
@codesandbox-ci
Copy link

codesandbox-ci bot commented Sep 22, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 8d1e62e:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

@babel-bot
Copy link
Collaborator

babel-bot commented Sep 22, 2021

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

Comment on lines +96 to +100
q.start -= 1;
if (q.tail) {
q.end += 1;
} else {
q.end += 2;
Copy link
Member

Choose a reason for hiding this comment

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

Does this close #13060?


const staticKw = { type: "Keyword", value: "static" };

expect(babylonAST.tokens[3]).toMatchObject(staticKw);
Copy link
Contributor

@JLHwung JLHwung Oct 12, 2021

Choose a reason for hiding this comment

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

We can avoid hard-coded tokens index by a class wrapper

function getFirstToken(source) {
  return parseForESLint(`class A { ${source} }`).ast.tokens[3];
}

expect(getFirstToken("static m() {}").toMatchObject(staticKw)
// ...

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd prefer to do that in a separate PR, since we would need to update the whole file.

@nicolo-ribaudo
Copy link
Member Author

I don't think we need docs for this, since we don't mention anywhere that we support ESLint 7.

@nicolo-ribaudo
Copy link
Member Author

I cannot reproduce the failures locally, and I'm confused because Node.js 17 (latest) fails but Node.js 16 doesn't 🤔

JLHwung
JLHwung previously approved these changes Oct 25, 2021
@JLHwung JLHwung dismissed their stale review October 25, 2021 20:05

CI errors related

@gajus gajus mentioned this pull request Oct 25, 2021
1 task
@@ -111,6 +114,7 @@ module.exports = function (api) {
case "development":
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should also add dynamicESLintVersionCheck = true; fore "test", the CI begins failing when I remove the plugin for test: JLHwung@f13dad3

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks!

@nicolo-ribaudo nicolo-ribaudo added the PR: Ready to be Merged A pull request with already two approvals, but waiting for the next minor release label Oct 26, 2021
@JLHwung JLHwung merged commit 381277a into babel:main Oct 28, 2021
@ljharb ljharb mentioned this pull request Nov 1, 2021
22 tasks
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jan 28, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: eslint outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: New Feature 🚀 A type of pull request used for our changelog categories PR: Ready to be Merged A pull request with already two approvals, but waiting for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support ESLint 8.x
4 participants