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
Merged

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.

@codesandbox
Copy link

@codesandbox codesandbox 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 babel-bot commented Sep 22, 2021

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

@nicolo-ribaudo nicolo-ribaudo marked this pull request as ready for review Sep 28, 2021
@nicolo-ribaudo nicolo-ribaudo added this to the Babel 8.0 milestone Sep 28, 2021
@nicolo-ribaudo nicolo-ribaudo removed this from the Babel 8.0 milestone Sep 28, 2021
@nicolo-ribaudo nicolo-ribaudo added this to the v7.16.0 milestone Sep 28, 2021
q.start -= 1;
if (q.tail) {
q.end += 1;
} else {
q.end += 2;
Copy link
Member

@fedeci fedeci Oct 11, 2021

Choose a reason for hiding this comment

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

Does this close #13060?

fedeci
fedeci approved these changes Oct 11, 2021

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

@nicolo-ribaudo nicolo-ribaudo Oct 24, 2021

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

@nicolo-ribaudo nicolo-ribaudo commented Oct 24, 2021

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

@nicolo-ribaudo nicolo-ribaudo force-pushed the eslint-8 branch 2 times, most recently from 55df468 to 7168c3d Oct 24, 2021
@nicolo-ribaudo
Copy link
Member Author

@nicolo-ribaudo nicolo-ribaudo commented Oct 24, 2021

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

@JLHwung JLHwung dismissed their stale review Oct 25, 2021

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

@JLHwung JLHwung Oct 26, 2021

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

@nicolo-ribaudo nicolo-ribaudo Oct 26, 2021

Choose a reason for hiding this comment

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

Thanks!

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

Successfully merging this pull request may close these issues.

4 participants