Skip to content

Commit b6bb564

Browse files
authored
Fix eslint-parser AST definition of AccessorProperty (#18257)
1 parent 41a16f6 commit b6bb564

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

‎eslint/babel-eslint-parser/src/ast-info.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export function getVisitorKeys() {
66
if (!visitorKeys) {
77
// AST Types that are not presented in Babel AST
88
const newTypes = {
9+
AccessorProperty: ["decorators", "typeAnnotation", "value", "key"],
910
ChainExpression: ESLINT_VISITOR_KEYS.ChainExpression,
1011
ImportExpression: ESLINT_VISITOR_KEYS.ImportExpression,
1112
Literal: ESLINT_VISITOR_KEYS.Literal,

‎eslint/babel-eslint-parser/test/typescript-estree.test.js‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,4 +460,11 @@ describe("Babel should output the same AST as TypeScript-Estree", () => {
460460
}
461461
}
462462
});
463+
464+
describe("templates", () => {
465+
// This test needs typescript-estree, espree doesn't support AccessorProperty
466+
it("template element ranges inside accessor property #18230", () => {
467+
parseAndAssertSame("class T { accessor a = `x${y}z`; }");
468+
});
469+
});
463470
});

0 commit comments

Comments
 (0)