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

Parse string export names by default (moduleStringNames) #13195

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/babel-parser/src/parser/statement.js
Expand Up @@ -2089,7 +2089,6 @@ export default class StatementParser extends ExpressionParser {
// https://tc39.es/ecma262/#prod-ModuleExportName
parseModuleExportName(): N.StringLiteral | N.Identifier {
if (this.match(tt.string)) {
this.expectPlugin("moduleStringNames");
const result = this.parseLiteral<N.StringLiteral>(
this.state.value,
"StringLiteral",
Expand Down
@@ -1,7 +1,4 @@
{
"sourceType": "module",
"plugins": [
"moduleStringNames"
],
"throws": "A string literal cannot be used as an imported binding.\n- Did you mean `import { \"foo\" as foo }`? (1:9)"
}
}
@@ -0,0 +1,3 @@
{
"sourceType": "module"
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

@@ -1,8 +1,5 @@
{
"sourceType": "module",
"plugins": [
"moduleStringNames",
"flow"
],
"plugins": ["flow"],
"throws": "A string literal cannot be used as an imported binding.\n- Did you mean `import { \"foo\" as foo }`? (1:9)"
}
@@ -1,4 +1,4 @@
{
"sourceType": "module",
"plugins": ["flow", "moduleStringNames"]
"plugins": ["flow"]
}
1 change: 0 additions & 1 deletion packages/babel-traverse/test/introspection.js
Expand Up @@ -176,7 +176,6 @@ describe("path/introspection", function () {
it('rejects the "export called *" trick', function () {
const program = getPath(`import * as ns from "source"; ns["*"].nested;`, {
sourceType: "module",
plugins: ["moduleStringNames"],
});
const reference = program.get("body.1.expression");
expect(reference.referencesImport("source", "nested")).toBe(false);
Expand Down