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

Compare export * directly to espree in eslint-parser #11819

Closed
wants to merge 3 commits into from

Conversation

existentialism
Copy link
Member

@existentialism existentialism commented Jul 10, 2020

Q                       A
Tests Added + Pass? Yes
License MIT

Piggybacking on #11815

@existentialism existentialism added PR: Internal 🏠 A type of pull request used for our changelog categories area: eslint labels Jul 10, 2020
@babel-bot
Copy link
Collaborator

babel-bot commented Jul 10, 2020

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

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 10, 2020

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 2f5eedd:

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

@existentialism
Copy link
Member Author

Note bumping eslint-scope is necessary to support ExportAllDeclaration => eslint/eslint-scope#56

@@ -249,7 +249,7 @@ defineType("ClassDeclaration", {
});

defineType("ExportAllDeclaration", {
visitor: ["source"],
visitor: ["source", "exported"],
Copy link
Member

Choose a reason for hiding this comment

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

What is this needed for?

Copy link
Member Author

Choose a reason for hiding this comment

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

We won't remove identifierName from the location if we don't visit it.

Copy link
Member

Choose a reason for hiding this comment

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

Oh ok, I was confused because it isn't in fields. Since it is ESTree-specific and not part of the Babel AST, maybe we should monkey patch it like we do it 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.

Good catch!

@@ -91,11 +91,19 @@ function convertNodes(ast, code) {
"typeParameters",
];

// Make sure we visit `exported` key to remove `identifierName` from loc node
const oldExportAllDeclarationKeys = t.VISITOR_KEYS.ExportAllDeclaration;
Copy link
Contributor

Choose a reason for hiding this comment

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

We should add ExportAllDeclaration to eslint/babel-eslint-parser/src/visitor-keys.js, too.

Copy link
Contributor

Choose a reason for hiding this comment

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

Well only some of them are picked:

{
Literal: ESLINT_VISITOR_KEYS.Literal,
MethodDefinition: ["decorators"].concat(
ESLINT_VISITOR_KEYS.MethodDefinition,
),
Property: ["decorators"].concat(ESLINT_VISITOR_KEYS.Property),
},

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, guess we have to add back ESLint's version since Babel's will overwrite it

@JLHwung
Copy link
Contributor

JLHwung commented Jul 10, 2020

Do you mind rebase your PR onto babel-eslint-2020 and submit this PR push to my repo? So we can track export * in #11815.

@existentialism
Copy link
Member Author

@JLHwung pushed to your branch

@existentialism existentialism deleted the eslintexportall branch July 10, 2020 21:21
@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 Oct 10, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 10, 2020
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: Internal 🏠 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants