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
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/25833/ |
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:
|
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"], |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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:
babel/eslint/babel-eslint-parser/src/visitor-keys.js
Lines 7 to 13 in ffb4248
{ | |
Literal: ESLINT_VISITOR_KEYS.Literal, | |
MethodDefinition: ["decorators"].concat( | |
ESLINT_VISITOR_KEYS.MethodDefinition, | |
), | |
Property: ["decorators"].concat(ESLINT_VISITOR_KEYS.Property), | |
}, |
There was a problem hiding this comment.
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
Do you mind rebase your PR onto |
@JLHwung pushed to your branch |
Piggybacking on #11815