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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: module expression scope handling #16037
Comments
Hey @DMartens! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly. If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite. |
Is there anything unclear with the bug report? |
Note that the In feel free to do the same for module expressions. As for the AST design, the |
馃捇
How are you using Babel?
@babel/eslint-parser
Input code
Code:
Programmatic access:
Configuration file name
babel.config.js
Configuration
Current and expected behavior
Currently parsing any code module expression and analyzing the scope will lead to an error:
This is triggered here in eslint-scope
The expectation is that no error is thrown.
Environment
Possible solution
The problem is that for module expressions
Program
nodes are generated which are already handled ineslint-scope
.The default visitor creates a global scope and expects no other scope to have been created but this then fails for the scope generated for module expressions.
As such the node must be handled explicitly in the referencer.
Either:
Program
node but not adding a global scope for module expressions in the referencerModuleBlock
node according to ESTree and add a visitor to the referencerAdditional context
I saw PR #15240 but this change also keeps creating
Program
nodes.If this bug report is approved would you prefer creating a
ModuleScope
or a new kind of scope for module expressions?The text was updated successfully, but these errors were encountered: