fix: add ImportExpression visitorKeys (#11932)
This commit is contained in:
parent
32744b2346
commit
48e793e964
@ -87,6 +87,7 @@ function convertNodes(ast, code) {
|
|||||||
try {
|
try {
|
||||||
// Monkey patch visitor keys in order to be able to traverse the estree nodes
|
// Monkey patch visitor keys in order to be able to traverse the estree nodes
|
||||||
t.VISITOR_KEYS.ChainExpression = VISITOR_KEYS.ChainExpression;
|
t.VISITOR_KEYS.ChainExpression = VISITOR_KEYS.ChainExpression;
|
||||||
|
t.VISITOR_KEYS.ImportExpression = VISITOR_KEYS.ImportExpression;
|
||||||
t.VISITOR_KEYS.Property = VISITOR_KEYS.Property;
|
t.VISITOR_KEYS.Property = VISITOR_KEYS.Property;
|
||||||
t.VISITOR_KEYS.MethodDefinition = VISITOR_KEYS.MethodDefinition;
|
t.VISITOR_KEYS.MethodDefinition = VISITOR_KEYS.MethodDefinition;
|
||||||
|
|
||||||
@ -99,6 +100,7 @@ function convertNodes(ast, code) {
|
|||||||
} finally {
|
} finally {
|
||||||
// These can be safely deleted because they are not defined in the original visitor keys.
|
// These can be safely deleted because they are not defined in the original visitor keys.
|
||||||
delete t.VISITOR_KEYS.ChainExpression;
|
delete t.VISITOR_KEYS.ChainExpression;
|
||||||
|
delete t.VISITOR_KEYS.ImportExpression;
|
||||||
delete t.VISITOR_KEYS.MethodDefinition;
|
delete t.VISITOR_KEYS.MethodDefinition;
|
||||||
delete t.VISITOR_KEYS.Property;
|
delete t.VISITOR_KEYS.Property;
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@ export default Object.assign(
|
|||||||
{
|
{
|
||||||
ChainExpression: ESLINT_VISITOR_KEYS.ChainExpression,
|
ChainExpression: ESLINT_VISITOR_KEYS.ChainExpression,
|
||||||
ExportAllDeclaration: ESLINT_VISITOR_KEYS.ExportAllDeclaration,
|
ExportAllDeclaration: ESLINT_VISITOR_KEYS.ExportAllDeclaration,
|
||||||
|
ImportExpression: ESLINT_VISITOR_KEYS.ImportExpression,
|
||||||
Literal: ESLINT_VISITOR_KEYS.Literal,
|
Literal: ESLINT_VISITOR_KEYS.Literal,
|
||||||
MethodDefinition: ["decorators"].concat(
|
MethodDefinition: ["decorators"].concat(
|
||||||
ESLINT_VISITOR_KEYS.MethodDefinition,
|
ESLINT_VISITOR_KEYS.MethodDefinition,
|
||||||
|
|||||||
@ -569,7 +569,7 @@ describe("Babel and Espree", () => {
|
|||||||
|
|
||||||
it("Dynamic Import", () => {
|
it("Dynamic Import", () => {
|
||||||
parseAndAssertSame(`
|
parseAndAssertSame(`
|
||||||
const a = import('a');
|
const a = import(moduleName);
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user