From 94c273a44fe1383069e95726af843c879d64925e Mon Sep 17 00:00:00 2001 From: fisker Date: Thu, 11 Sep 2025 05:37:48 +0800 Subject: [PATCH 1/2] fix(typescript-estree): forbid class property with name `constructor` --- .../key-constructor-string-escaped/fixture.ts | 3 + .../snapshots/1-TSESTree-Error.shot | 9 ++ .../snapshots/2-Babel-Error.shot | 10 ++ .../snapshots/3-Alignment-Error.shot | 4 + .../_error_/key-constructor-string/fixture.ts | 3 + .../snapshots/1-TSESTree-Error.shot | 9 ++ .../snapshots/2-Babel-Error.shot | 10 ++ .../snapshots/3-Alignment-Error.shot | 4 + .../fixture.ts | 3 + .../snapshots/1-TSESTree-AST.shot | 79 ++++++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 82 +++++++++++++++++ .../snapshots/3-Babel-AST.shot | 79 ++++++++++++++++ .../snapshots/4-Babel-Tokens.shot | 82 +++++++++++++++++ .../fixture.ts | 3 + .../snapshots/1-TSESTree-AST.shot | 78 ++++++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 82 +++++++++++++++++ .../snapshots/3-Babel-AST.shot | 78 ++++++++++++++++ .../snapshots/4-Babel-Tokens.shot | 82 +++++++++++++++++ .../key-constructor-identifier/fixture.ts | 3 + .../snapshots/1-TSESTree-Error.shot | 9 ++ .../snapshots/2-Babel-Error.shot | 10 ++ .../snapshots/3-Alignment-Error.shot | 4 + .../key-constructor-string-escaped/fixture.ts | 3 + .../snapshots/1-TSESTree-Error.shot | 9 ++ .../snapshots/2-Babel-Error.shot | 10 ++ .../snapshots/3-Alignment-Error.shot | 4 + .../_error_/key-constructor-string/fixture.ts | 3 + .../snapshots/1-TSESTree-Error.shot | 9 ++ .../snapshots/2-Babel-Error.shot | 10 ++ .../snapshots/3-Alignment-Error.shot | 4 + .../fixture.ts | 3 + .../snapshots/1-TSESTree-AST.shot | 79 ++++++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 72 +++++++++++++++ .../snapshots/3-Babel-AST.shot | 79 ++++++++++++++++ .../snapshots/4-Babel-Tokens.shot | 72 +++++++++++++++ .../fixture.ts | 3 + .../snapshots/1-TSESTree-AST.shot | 78 ++++++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 72 +++++++++++++++ .../snapshots/3-Babel-AST.shot | 78 ++++++++++++++++ .../snapshots/4-Babel-Tokens.shot | 72 +++++++++++++++ .../key-constructor-string-escaped/fixture.ts | 3 + .../snapshots/1-TSESTree-Error.shot | 9 ++ .../snapshots/2-Babel-Error.shot | 10 ++ .../snapshots/3-Alignment-Error.shot | 4 + .../_error_/key-constructor-string/fixture.ts | 3 + .../snapshots/1-TSESTree-Error.shot | 9 ++ .../snapshots/2-Babel-Error.shot | 10 ++ .../snapshots/3-Alignment-Error.shot | 4 + .../fixture.ts | 3 + .../snapshots/1-TSESTree-AST.shot | 79 ++++++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 92 +++++++++++++++++++ .../snapshots/3-Babel-AST.shot | 79 ++++++++++++++++ .../snapshots/4-Babel-Tokens.shot | 92 +++++++++++++++++++ .../fixture.ts | 3 + .../snapshots/1-TSESTree-AST.shot | 78 ++++++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 92 +++++++++++++++++++ .../snapshots/3-Babel-AST.shot | 78 ++++++++++++++++ .../snapshots/4-Babel-Tokens.shot | 92 +++++++++++++++++++ .../key-constructor-identifier/fixture.ts | 3 + .../snapshots/1-TSESTree-Error.shot | 9 ++ .../snapshots/2-Babel-Error.shot | 10 ++ .../snapshots/3-Alignment-Error.shot | 4 + .../key-constructor-string-escaped/fixture.ts | 3 + .../snapshots/1-TSESTree-Error.shot | 9 ++ .../snapshots/2-Babel-Error.shot | 10 ++ .../snapshots/3-Alignment-Error.shot | 4 + .../_error_/key-constructor-string/fixture.ts | 3 + .../snapshots/1-TSESTree-Error.shot | 9 ++ .../snapshots/2-Babel-Error.shot | 10 ++ .../snapshots/3-Alignment-Error.shot | 4 + .../fixture.ts | 3 + .../snapshots/1-TSESTree-AST.shot | 79 ++++++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 82 +++++++++++++++++ .../snapshots/3-Babel-AST.shot | 79 ++++++++++++++++ .../snapshots/4-Babel-Tokens.shot | 82 +++++++++++++++++ .../fixture.ts | 3 + .../snapshots/1-TSESTree-AST.shot | 78 ++++++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 82 +++++++++++++++++ .../snapshots/3-Babel-AST.shot | 78 ++++++++++++++++ .../snapshots/4-Babel-Tokens.shot | 82 +++++++++++++++++ packages/typescript-estree/src/convert.ts | 10 ++ 81 files changed, 2862 insertions(+) create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/fixture.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/fixture.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/fixture.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/fixture.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/fixture.ts create mode 100644 packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/fixture.ts create mode 100644 packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/fixture.ts create mode 100644 packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/fixture.ts create mode 100644 packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/fixture.ts create mode 100644 packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/fixture.ts create mode 100644 packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/fixture.ts create mode 100644 packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/fixture.ts create mode 100644 packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/fixture.ts create mode 100644 packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/fixture.ts create mode 100644 packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/fixture.ts create mode 100644 packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/fixture.ts create mode 100644 packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/fixture.ts create mode 100644 packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/fixture.ts create mode 100644 packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/fixture.ts new file mode 100644 index 000000000000..fe9d09f5c8b5 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + accessor '\u{63}onstructor' +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..1efee502ef1a --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > AccessorProperty > _error_ > key-constructor-string-escaped > TSESTree - Error`] +TSError + 1 | class Foo { +> 2 | accessor '\u{63}onstructor' + | ^^^^^^^^^^^^^^^^^^ Classes may not have a field named 'constructor'. + 3 | } + 4 | diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..b36c85229b5d --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > AccessorProperty > _error_ > key-constructor-string-escaped > Babel - Error`] +BabelError + 1 | class Foo { +> 2 | accessor '\u{63}onstructor' + | ^ Classes may not have a field named 'constructor'. (2:11) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..1b975851c82a --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > AccessorProperty > _error_ > key-constructor-string-escaped > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/fixture.ts new file mode 100644 index 000000000000..15b65f9026f1 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + accessor 'constructor' +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..99225f26fe0f --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > AccessorProperty > _error_ > key-constructor-string > TSESTree - Error`] +TSError + 1 | class Foo { +> 2 | accessor 'constructor' + | ^^^^^^^^^^^^^ Classes may not have a field named 'constructor'. + 3 | } + 4 | diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..bb359842fe1e --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > AccessorProperty > _error_ > key-constructor-string > Babel - Error`] +BabelError + 1 | class Foo { +> 2 | accessor 'constructor' + | ^ Classes may not have a field named 'constructor'. (2:11) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..d6b1cda3e19b --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > AccessorProperty > _error_ > key-constructor-string > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/fixture.ts new file mode 100644 index 000000000000..20dcea55b511 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + accessor [constructor] +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..574aab900d6e --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,79 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: false, + body: ClassBody { + type: "ClassBody", + body: [ + AccessorProperty { + type: "AccessorProperty", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "constructor", + optional: false, + + range: [24, 35], + loc: { + start: { column: 12, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [14, 36], + loc: { + start: { column: 2, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + ], + + range: [10, 38], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 38], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 39], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..d2835a52504e --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,82 @@ +[ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [23, 24], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "constructor", + + range: [24, 35], + loc: { + start: { column: 12, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [35, 36], + loc: { + start: { column: 23, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [37, 38], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..574aab900d6e --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot @@ -0,0 +1,79 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: false, + body: ClassBody { + type: "ClassBody", + body: [ + AccessorProperty { + type: "AccessorProperty", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "constructor", + optional: false, + + range: [24, 35], + loc: { + start: { column: 12, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [14, 36], + loc: { + start: { column: 2, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + ], + + range: [10, 38], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 38], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 39], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..d2835a52504e --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,82 @@ +[ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [23, 24], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "constructor", + + range: [24, 35], + loc: { + start: { column: 12, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [35, 36], + loc: { + start: { column: 23, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [37, 38], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/fixture.ts new file mode 100644 index 000000000000..0d04cbad933f --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + accessor ['constructor'] +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..8674713e2579 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,78 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: false, + body: ClassBody { + type: "ClassBody", + body: [ + AccessorProperty { + type: "AccessorProperty", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Literal { + type: "Literal", + raw: "'constructor'", + value: "constructor", + + range: [24, 37], + loc: { + start: { column: 12, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [14, 38], + loc: { + start: { column: 2, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + ], + + range: [10, 40], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 40], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 41], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..a9866b92f00b --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,82 @@ +[ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [23, 24], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + String { + type: "String", + value: "'constructor'", + + range: [24, 37], + loc: { + start: { column: 12, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [37, 38], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [39, 40], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..8674713e2579 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot @@ -0,0 +1,78 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: false, + body: ClassBody { + type: "ClassBody", + body: [ + AccessorProperty { + type: "AccessorProperty", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Literal { + type: "Literal", + raw: "'constructor'", + value: "constructor", + + range: [24, 37], + loc: { + start: { column: 12, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [14, 38], + loc: { + start: { column: 2, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + ], + + range: [10, 40], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 40], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 41], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..a9866b92f00b --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,82 @@ +[ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [23, 24], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + String { + type: "String", + value: "'constructor'", + + range: [24, 37], + loc: { + start: { column: 12, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [37, 38], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [39, 40], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/fixture.ts b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/fixture.ts new file mode 100644 index 000000000000..581943685ffe --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + constructor +} diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..ed0ae4b78658 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > PropertyDefinition > _error_ > key-constructor-identifier > TSESTree - Error`] +TSError + 1 | class Foo { + 2 | constructor +> 3 | } + | ^ '(' expected. + 4 | diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..680ca51c5b1a --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > PropertyDefinition > _error_ > key-constructor-identifier > Babel - Error`] +BabelError + 1 | class Foo { +> 2 | constructor + | ^ Classes may not have a field named 'constructor'. (2:2) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..dda789130572 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > PropertyDefinition > _error_ > key-constructor-identifier > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/fixture.ts b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/fixture.ts new file mode 100644 index 000000000000..5dc0386f85fe --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + '\u{63}onstructor' +} diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..53cc50de6a35 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > PropertyDefinition > _error_ > key-constructor-string-escaped > TSESTree - Error`] +TSError + 1 | class Foo { +> 2 | '\u{63}onstructor' + | ^^^^^^^^^^^^^^^^^^ Classes may not have a field named 'constructor'. + 3 | } + 4 | diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..130b27dcc413 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > PropertyDefinition > _error_ > key-constructor-string-escaped > Babel - Error`] +BabelError + 1 | class Foo { +> 2 | '\u{63}onstructor' + | ^ Classes may not have a field named 'constructor'. (2:2) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..b3922ac52bf5 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > PropertyDefinition > _error_ > key-constructor-string-escaped > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/fixture.ts b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/fixture.ts new file mode 100644 index 000000000000..d29a35ffdbb7 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + 'constructor' +} diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..46f1efa8ad71 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > PropertyDefinition > _error_ > key-constructor-string > TSESTree - Error`] +TSError + 1 | class Foo { +> 2 | 'constructor' + | ^^^^^^^^^^^^^ Classes may not have a field named 'constructor'. + 3 | } + 4 | diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..eaac47437927 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > PropertyDefinition > _error_ > key-constructor-string > Babel - Error`] +BabelError + 1 | class Foo { +> 2 | 'constructor' + | ^ Classes may not have a field named 'constructor'. (2:2) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..86e611b5b35d --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > PropertyDefinition > _error_ > key-constructor-string > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/fixture.ts b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/fixture.ts new file mode 100644 index 000000000000..7de7f617d5c3 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + [constructor] +} diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..cc5ab261b3d8 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,79 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: false, + body: ClassBody { + type: "ClassBody", + body: [ + PropertyDefinition { + type: "PropertyDefinition", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "constructor", + optional: false, + + range: [15, 26], + loc: { + start: { column: 3, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [14, 27], + loc: { + start: { column: 2, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + ], + + range: [10, 29], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..786b0eca2d3c --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,72 @@ +[ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [14, 15], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "constructor", + + range: [15, 26], + loc: { + start: { column: 3, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [26, 27], + loc: { + start: { column: 14, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [28, 29], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..cc5ab261b3d8 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot @@ -0,0 +1,79 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: false, + body: ClassBody { + type: "ClassBody", + body: [ + PropertyDefinition { + type: "PropertyDefinition", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "constructor", + optional: false, + + range: [15, 26], + loc: { + start: { column: 3, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [14, 27], + loc: { + start: { column: 2, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + ], + + range: [10, 29], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..786b0eca2d3c --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,72 @@ +[ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [14, 15], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "constructor", + + range: [15, 26], + loc: { + start: { column: 3, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [26, 27], + loc: { + start: { column: 14, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [28, 29], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/fixture.ts b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/fixture.ts new file mode 100644 index 000000000000..64da0c1bd9f8 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + ['constructor'] +} diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..5423ced56ba9 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,78 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: false, + body: ClassBody { + type: "ClassBody", + body: [ + PropertyDefinition { + type: "PropertyDefinition", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Literal { + type: "Literal", + raw: "'constructor'", + value: "constructor", + + range: [15, 28], + loc: { + start: { column: 3, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [14, 29], + loc: { + start: { column: 2, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + ], + + range: [10, 31], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..a127e69a02b0 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,72 @@ +[ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [14, 15], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + String { + type: "String", + value: "'constructor'", + + range: [15, 28], + loc: { + start: { column: 3, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [28, 29], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [30, 31], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..5423ced56ba9 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot @@ -0,0 +1,78 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: false, + body: ClassBody { + type: "ClassBody", + body: [ + PropertyDefinition { + type: "PropertyDefinition", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Literal { + type: "Literal", + raw: "'constructor'", + value: "constructor", + + range: [15, 28], + loc: { + start: { column: 3, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [14, 29], + loc: { + start: { column: 2, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + ], + + range: [10, 31], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..a127e69a02b0 --- /dev/null +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,72 @@ +[ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [14, 15], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + String { + type: "String", + value: "'constructor'", + + range: [15, 28], + loc: { + start: { column: 3, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [28, 29], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [30, 31], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/fixture.ts b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/fixture.ts new file mode 100644 index 000000000000..2d83385d93bf --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + accessor '\u{63}onstructor' +} diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..e2a98ea43e52 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractAccessorProperty > _error_ > key-constructor-string-escaped > TSESTree - Error`] +TSError + 1 | abstract class Foo { +> 2 | accessor '\u{63}onstructor' + | ^^^^^^^^^^^^^^^^^^ Classes may not have a field named 'constructor'. + 3 | } + 4 | diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..73035ad32ef8 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractAccessorProperty > _error_ > key-constructor-string-escaped > Babel - Error`] +BabelError + 1 | abstract class Foo { +> 2 | accessor '\u{63}onstructor' + | ^ Classes may not have a field named 'constructor'. (2:11) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..f4851859171d --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractAccessorProperty > _error_ > key-constructor-string-escaped > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/fixture.ts b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/fixture.ts new file mode 100644 index 000000000000..84fb8c4caa3f --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + accessor 'constructor' +} diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..97e1650fccca --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractAccessorProperty > _error_ > key-constructor-string > TSESTree - Error`] +TSError + 1 | abstract class Foo { +> 2 | accessor 'constructor' + | ^^^^^^^^^^^^^ Classes may not have a field named 'constructor'. + 3 | } + 4 | diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..9f0cd2ea63f0 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractAccessorProperty > _error_ > key-constructor-string > Babel - Error`] +BabelError + 1 | abstract class Foo { +> 2 | accessor 'constructor' + | ^ Classes may not have a field named 'constructor'. (2:11) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..c6bb852e8a96 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractAccessorProperty > _error_ > key-constructor-string > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/fixture.ts b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/fixture.ts new file mode 100644 index 000000000000..9289b067bfe8 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + accessor [constructor] +} diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..4dfbf670302b --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,79 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: true, + body: ClassBody { + type: "ClassBody", + body: [ + AccessorProperty { + type: "AccessorProperty", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "constructor", + optional: false, + + range: [33, 44], + loc: { + start: { column: 12, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [23, 45], + loc: { + start: { column: 2, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + ], + + range: [19, 47], + loc: { + start: { column: 19, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 47], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 48], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..f183c6bedce8 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,92 @@ +[ + Identifier { + type: "Identifier", + value: "abstract", + + range: [0, 8], + loc: { + start: { column: 0, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [23, 31], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [32, 33], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "constructor", + + range: [33, 44], + loc: { + start: { column: 12, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [44, 45], + loc: { + start: { column: 23, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [46, 47], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..4dfbf670302b --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot @@ -0,0 +1,79 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: true, + body: ClassBody { + type: "ClassBody", + body: [ + AccessorProperty { + type: "AccessorProperty", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "constructor", + optional: false, + + range: [33, 44], + loc: { + start: { column: 12, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [23, 45], + loc: { + start: { column: 2, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + ], + + range: [19, 47], + loc: { + start: { column: 19, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 47], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 48], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..f183c6bedce8 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,92 @@ +[ + Identifier { + type: "Identifier", + value: "abstract", + + range: [0, 8], + loc: { + start: { column: 0, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [23, 31], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [32, 33], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "constructor", + + range: [33, 44], + loc: { + start: { column: 12, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [44, 45], + loc: { + start: { column: 23, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [46, 47], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/fixture.ts b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/fixture.ts new file mode 100644 index 000000000000..2671ed1cd445 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + accessor ['constructor'] +} diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..75031f7f1e88 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,78 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: true, + body: ClassBody { + type: "ClassBody", + body: [ + AccessorProperty { + type: "AccessorProperty", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Literal { + type: "Literal", + raw: "'constructor'", + value: "constructor", + + range: [33, 46], + loc: { + start: { column: 12, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [23, 47], + loc: { + start: { column: 2, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + ], + + range: [19, 49], + loc: { + start: { column: 19, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 49], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 50], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..a9d42164d739 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,92 @@ +[ + Identifier { + type: "Identifier", + value: "abstract", + + range: [0, 8], + loc: { + start: { column: 0, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [23, 31], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [32, 33], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + String { + type: "String", + value: "'constructor'", + + range: [33, 46], + loc: { + start: { column: 12, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [46, 47], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [48, 49], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..75031f7f1e88 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot @@ -0,0 +1,78 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: true, + body: ClassBody { + type: "ClassBody", + body: [ + AccessorProperty { + type: "AccessorProperty", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Literal { + type: "Literal", + raw: "'constructor'", + value: "constructor", + + range: [33, 46], + loc: { + start: { column: 12, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [23, 47], + loc: { + start: { column: 2, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + ], + + range: [19, 49], + loc: { + start: { column: 19, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 49], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 50], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..a9d42164d739 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,92 @@ +[ + Identifier { + type: "Identifier", + value: "abstract", + + range: [0, 8], + loc: { + start: { column: 0, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [23, 31], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [32, 33], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + String { + type: "String", + value: "'constructor'", + + range: [33, 46], + loc: { + start: { column: 12, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [46, 47], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [48, 49], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/fixture.ts b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/fixture.ts new file mode 100644 index 000000000000..a70cc4d0b84e --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + constructor +} diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..d4dac96c3819 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractPropertyDefinition > _error_ > key-constructor-identifier > TSESTree - Error`] +TSError + 1 | abstract class Foo { + 2 | constructor +> 3 | } + | ^ '(' expected. + 4 | diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..40ef5d1ba178 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractPropertyDefinition > _error_ > key-constructor-identifier > Babel - Error`] +BabelError + 1 | abstract class Foo { +> 2 | constructor + | ^ Classes may not have a field named 'constructor'. (2:2) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..c03db2425706 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-identifier/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractPropertyDefinition > _error_ > key-constructor-identifier > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/fixture.ts b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/fixture.ts new file mode 100644 index 000000000000..3964b6ad536d --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + '\u{63}onstructor' +} diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..832a69aba874 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractPropertyDefinition > _error_ > key-constructor-string-escaped > TSESTree - Error`] +TSError + 1 | abstract class Foo { +> 2 | '\u{63}onstructor' + | ^^^^^^^^^^^^^^^^^^ Classes may not have a field named 'constructor'. + 3 | } + 4 | diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..972fa63aaaf7 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractPropertyDefinition > _error_ > key-constructor-string-escaped > Babel - Error`] +BabelError + 1 | abstract class Foo { +> 2 | '\u{63}onstructor' + | ^ Classes may not have a field named 'constructor'. (2:2) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..c784e6ef8f7e --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string-escaped/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractPropertyDefinition > _error_ > key-constructor-string-escaped > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/fixture.ts b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/fixture.ts new file mode 100644 index 000000000000..773be1c59705 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + 'constructor' +} diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..e70630a8db65 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractPropertyDefinition > _error_ > key-constructor-string > TSESTree - Error`] +TSError + 1 | abstract class Foo { +> 2 | 'constructor' + | ^^^^^^^^^^^^^ Classes may not have a field named 'constructor'. + 3 | } + 4 | diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..0b562418bd7a --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractPropertyDefinition > _error_ > key-constructor-string > Babel - Error`] +BabelError + 1 | abstract class Foo { +> 2 | 'constructor' + | ^ Classes may not have a field named 'constructor'. (2:2) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..e72b64ca43be --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/_error_/key-constructor-string/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSAbstractPropertyDefinition > _error_ > key-constructor-string > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/fixture.ts b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/fixture.ts new file mode 100644 index 000000000000..a4c2cc0e7547 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + [constructor] +} diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..3145f7caa799 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,79 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: true, + body: ClassBody { + type: "ClassBody", + body: [ + PropertyDefinition { + type: "PropertyDefinition", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "constructor", + optional: false, + + range: [24, 35], + loc: { + start: { column: 3, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [23, 36], + loc: { + start: { column: 2, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + ], + + range: [19, 38], + loc: { + start: { column: 19, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 38], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 39], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..931b669ee26f --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,82 @@ +[ + Identifier { + type: "Identifier", + value: "abstract", + + range: [0, 8], + loc: { + start: { column: 0, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [23, 24], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "constructor", + + range: [24, 35], + loc: { + start: { column: 3, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [35, 36], + loc: { + start: { column: 14, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [37, 38], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..3145f7caa799 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot @@ -0,0 +1,79 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: true, + body: ClassBody { + type: "ClassBody", + body: [ + PropertyDefinition { + type: "PropertyDefinition", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "constructor", + optional: false, + + range: [24, 35], + loc: { + start: { column: 3, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [23, 36], + loc: { + start: { column: 2, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + ], + + range: [19, 38], + loc: { + start: { column: 19, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 38], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 39], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..931b669ee26f --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,82 @@ +[ + Identifier { + type: "Identifier", + value: "abstract", + + range: [0, 8], + loc: { + start: { column: 0, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [23, 24], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "constructor", + + range: [24, 35], + loc: { + start: { column: 3, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [35, 36], + loc: { + start: { column: 14, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [37, 38], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/fixture.ts b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/fixture.ts new file mode 100644 index 000000000000..9d7976a8d2ed --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + ['constructor'] +} diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..6e69c4edb81b --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,78 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: true, + body: ClassBody { + type: "ClassBody", + body: [ + PropertyDefinition { + type: "PropertyDefinition", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Literal { + type: "Literal", + raw: "'constructor'", + value: "constructor", + + range: [24, 37], + loc: { + start: { column: 3, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [23, 38], + loc: { + start: { column: 2, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + ], + + range: [19, 40], + loc: { + start: { column: 19, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 40], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 41], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..3e6d8e4dabf3 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,82 @@ +[ + Identifier { + type: "Identifier", + value: "abstract", + + range: [0, 8], + loc: { + start: { column: 0, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [23, 24], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + String { + type: "String", + value: "'constructor'", + + range: [24, 37], + loc: { + start: { column: 3, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [37, 38], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [39, 40], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..6e69c4edb81b --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot @@ -0,0 +1,78 @@ +Program { + type: "Program", + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: true, + body: ClassBody { + type: "ClassBody", + body: [ + PropertyDefinition { + type: "PropertyDefinition", + computed: true, + declare: false, + decorators: [], + definite: false, + key: Literal { + type: "Literal", + raw: "'constructor'", + value: "constructor", + + range: [24, 37], + loc: { + start: { column: 3, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: null, + + range: [23, 38], + loc: { + start: { column: 2, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + ], + + range: [19, 40], + loc: { + start: { column: 19, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 40], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 41], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..3e6d8e4dabf3 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,82 @@ +[ + Identifier { + type: "Identifier", + value: "abstract", + + range: [0, 8], + loc: { + start: { column: 0, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [23, 24], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + String { + type: "String", + value: "'constructor'", + + range: [24, 37], + loc: { + start: { column: 3, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [37, 38], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [39, 40], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] \ No newline at end of file diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 0ffc735c3a14..cbeac4bf65cc 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -1524,6 +1524,16 @@ export class Converter { ); } + if ( + node.name.kind === SyntaxKind.StringLiteral && + node.name.text === 'constructor' + ) { + this.#throwError( + node.name, + "Classes may not have a field named 'constructor'.", + ); + } + const isAccessor = hasModifier(SyntaxKind.AccessorKeyword, node); const type = (() => { if (isAccessor) { From c8686b8e855c1959e32006c672a893fb9afb8a77 Mon Sep 17 00:00:00 2001 From: fisker Date: Thu, 11 Sep 2025 05:49:12 +0800 Subject: [PATCH 2/2] Format fixtures --- .../key-constructor-identifier-computed/fixture.ts | 2 +- .../snapshots/1-TSESTree-AST.shot | 10 +++++----- .../snapshots/2-TSESTree-Tokens.shot | 12 +++++++++++- .../snapshots/3-Babel-AST.shot | 10 +++++----- .../snapshots/4-Babel-Tokens.shot | 12 +++++++++++- .../key-constructor-string-computed/fixture.ts | 2 +- .../snapshots/1-TSESTree-AST.shot | 10 +++++----- .../snapshots/2-TSESTree-Tokens.shot | 12 +++++++++++- .../snapshots/3-Babel-AST.shot | 10 +++++----- .../snapshots/4-Babel-Tokens.shot | 12 +++++++++++- .../key-constructor-identifier-computed/fixture.ts | 2 +- .../snapshots/1-TSESTree-AST.shot | 10 +++++----- .../snapshots/2-TSESTree-Tokens.shot | 12 +++++++++++- .../snapshots/3-Babel-AST.shot | 10 +++++----- .../snapshots/4-Babel-Tokens.shot | 12 +++++++++++- .../key-constructor-string-computed/fixture.ts | 2 +- .../snapshots/1-TSESTree-AST.shot | 10 +++++----- .../snapshots/2-TSESTree-Tokens.shot | 12 +++++++++++- .../snapshots/3-Babel-AST.shot | 10 +++++----- .../snapshots/4-Babel-Tokens.shot | 12 +++++++++++- .../key-constructor-identifier-computed/fixture.ts | 2 +- .../snapshots/1-TSESTree-AST.shot | 10 +++++----- .../snapshots/2-TSESTree-Tokens.shot | 12 +++++++++++- .../snapshots/3-Babel-AST.shot | 10 +++++----- .../snapshots/4-Babel-Tokens.shot | 12 +++++++++++- .../key-constructor-string-computed/fixture.ts | 2 +- .../snapshots/1-TSESTree-AST.shot | 10 +++++----- .../snapshots/2-TSESTree-Tokens.shot | 12 +++++++++++- .../snapshots/3-Babel-AST.shot | 10 +++++----- .../snapshots/4-Babel-Tokens.shot | 12 +++++++++++- .../key-constructor-identifier-computed/fixture.ts | 2 +- .../snapshots/1-TSESTree-AST.shot | 10 +++++----- .../snapshots/2-TSESTree-Tokens.shot | 12 +++++++++++- .../snapshots/3-Babel-AST.shot | 10 +++++----- .../snapshots/4-Babel-Tokens.shot | 12 +++++++++++- .../key-constructor-string-computed/fixture.ts | 2 +- .../snapshots/1-TSESTree-AST.shot | 10 +++++----- .../snapshots/2-TSESTree-Tokens.shot | 12 +++++++++++- .../snapshots/3-Babel-AST.shot | 10 +++++----- .../snapshots/4-Babel-Tokens.shot | 12 +++++++++++- 40 files changed, 264 insertions(+), 104 deletions(-) diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/fixture.ts index 20dcea55b511..176558f7f971 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/fixture.ts +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/fixture.ts @@ -1,3 +1,3 @@ class Foo { - accessor [constructor] + accessor [constructor]; } diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot index 574aab900d6e..0bd9d71a1338 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot @@ -31,15 +31,15 @@ Program { static: false, value: null, - range: [14, 36], + range: [14, 37], loc: { start: { column: 2, line: 2 }, - end: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, }, }, ], - range: [10, 38], + range: [10, 39], loc: { start: { column: 10, line: 1 }, end: { column: 1, line: 3 }, @@ -62,7 +62,7 @@ Program { implements: [], superClass: null, - range: [0, 38], + range: [0, 39], loc: { start: { column: 0, line: 1 }, end: { column: 1, line: 3 }, @@ -71,7 +71,7 @@ Program { ], sourceType: "script", - range: [0, 39], + range: [0, 40], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 4 }, diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot index d2835a52504e..ced41a5029ae 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot @@ -69,11 +69,21 @@ end: { column: 24, line: 2 }, }, }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, Punctuator { type: "Punctuator", value: "}", - range: [37, 38], + range: [38, 39], loc: { start: { column: 0, line: 3 }, end: { column: 1, line: 3 }, diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot index 574aab900d6e..0bd9d71a1338 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot @@ -31,15 +31,15 @@ Program { static: false, value: null, - range: [14, 36], + range: [14, 37], loc: { start: { column: 2, line: 2 }, - end: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, }, }, ], - range: [10, 38], + range: [10, 39], loc: { start: { column: 10, line: 1 }, end: { column: 1, line: 3 }, @@ -62,7 +62,7 @@ Program { implements: [], superClass: null, - range: [0, 38], + range: [0, 39], loc: { start: { column: 0, line: 1 }, end: { column: 1, line: 3 }, @@ -71,7 +71,7 @@ Program { ], sourceType: "script", - range: [0, 39], + range: [0, 40], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 4 }, diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot index d2835a52504e..ced41a5029ae 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot @@ -69,11 +69,21 @@ end: { column: 24, line: 2 }, }, }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, Punctuator { type: "Punctuator", value: "}", - range: [37, 38], + range: [38, 39], loc: { start: { column: 0, line: 3 }, end: { column: 1, line: 3 }, diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/fixture.ts index 0d04cbad933f..acc5cfe6398a 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/fixture.ts +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/fixture.ts @@ -1,3 +1,3 @@ class Foo { - accessor ['constructor'] + accessor ['constructor']; } diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot index 8674713e2579..5b9bbadd0d07 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot @@ -30,15 +30,15 @@ Program { static: false, value: null, - range: [14, 38], + range: [14, 39], loc: { start: { column: 2, line: 2 }, - end: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, }, }, ], - range: [10, 40], + range: [10, 41], loc: { start: { column: 10, line: 1 }, end: { column: 1, line: 3 }, @@ -61,7 +61,7 @@ Program { implements: [], superClass: null, - range: [0, 40], + range: [0, 41], loc: { start: { column: 0, line: 1 }, end: { column: 1, line: 3 }, @@ -70,7 +70,7 @@ Program { ], sourceType: "script", - range: [0, 41], + range: [0, 42], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 4 }, diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot index a9866b92f00b..30151a9636c9 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot @@ -69,11 +69,21 @@ end: { column: 26, line: 2 }, }, }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [38, 39], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, Punctuator { type: "Punctuator", value: "}", - range: [39, 40], + range: [40, 41], loc: { start: { column: 0, line: 3 }, end: { column: 1, line: 3 }, diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot index 8674713e2579..5b9bbadd0d07 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot @@ -30,15 +30,15 @@ Program { static: false, value: null, - range: [14, 38], + range: [14, 39], loc: { start: { column: 2, line: 2 }, - end: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, }, }, ], - range: [10, 40], + range: [10, 41], loc: { start: { column: 10, line: 1 }, end: { column: 1, line: 3 }, @@ -61,7 +61,7 @@ Program { implements: [], superClass: null, - range: [0, 40], + range: [0, 41], loc: { start: { column: 0, line: 1 }, end: { column: 1, line: 3 }, @@ -70,7 +70,7 @@ Program { ], sourceType: "script", - range: [0, 41], + range: [0, 42], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 4 }, diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot index a9866b92f00b..30151a9636c9 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot @@ -69,11 +69,21 @@ end: { column: 26, line: 2 }, }, }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [38, 39], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, Punctuator { type: "Punctuator", value: "}", - range: [39, 40], + range: [40, 41], loc: { start: { column: 0, line: 3 }, end: { column: 1, line: 3 }, diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/fixture.ts b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/fixture.ts index 7de7f617d5c3..8846529091d9 100644 --- a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/fixture.ts +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/fixture.ts @@ -1,3 +1,3 @@ class Foo { - [constructor] + [constructor]; } diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot index cc5ab261b3d8..036f1181e9b7 100644 --- a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot @@ -31,15 +31,15 @@ Program { static: false, value: null, - range: [14, 27], + range: [14, 28], loc: { start: { column: 2, line: 2 }, - end: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, }, }, ], - range: [10, 29], + range: [10, 30], loc: { start: { column: 10, line: 1 }, end: { column: 1, line: 3 }, @@ -62,7 +62,7 @@ Program { implements: [], superClass: null, - range: [0, 29], + range: [0, 30], loc: { start: { column: 0, line: 1 }, end: { column: 1, line: 3 }, @@ -71,7 +71,7 @@ Program { ], sourceType: "script", - range: [0, 30], + range: [0, 31], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 4 }, diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot index 786b0eca2d3c..93100d49782c 100644 --- a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot @@ -59,11 +59,21 @@ end: { column: 15, line: 2 }, }, }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [27, 28], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, Punctuator { type: "Punctuator", value: "}", - range: [28, 29], + range: [29, 30], loc: { start: { column: 0, line: 3 }, end: { column: 1, line: 3 }, diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot index cc5ab261b3d8..036f1181e9b7 100644 --- a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot @@ -31,15 +31,15 @@ Program { static: false, value: null, - range: [14, 27], + range: [14, 28], loc: { start: { column: 2, line: 2 }, - end: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, }, }, ], - range: [10, 29], + range: [10, 30], loc: { start: { column: 10, line: 1 }, end: { column: 1, line: 3 }, @@ -62,7 +62,7 @@ Program { implements: [], superClass: null, - range: [0, 29], + range: [0, 30], loc: { start: { column: 0, line: 1 }, end: { column: 1, line: 3 }, @@ -71,7 +71,7 @@ Program { ], sourceType: "script", - range: [0, 30], + range: [0, 31], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 4 }, diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot index 786b0eca2d3c..93100d49782c 100644 --- a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot @@ -59,11 +59,21 @@ end: { column: 15, line: 2 }, }, }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [27, 28], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, Punctuator { type: "Punctuator", value: "}", - range: [28, 29], + range: [29, 30], loc: { start: { column: 0, line: 3 }, end: { column: 1, line: 3 }, diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/fixture.ts b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/fixture.ts index 64da0c1bd9f8..955e0ccdd551 100644 --- a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/fixture.ts +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/fixture.ts @@ -1,3 +1,3 @@ class Foo { - ['constructor'] + ['constructor']; } diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot index 5423ced56ba9..a35a705153a3 100644 --- a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot @@ -30,15 +30,15 @@ Program { static: false, value: null, - range: [14, 29], + range: [14, 30], loc: { start: { column: 2, line: 2 }, - end: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, }, }, ], - range: [10, 31], + range: [10, 32], loc: { start: { column: 10, line: 1 }, end: { column: 1, line: 3 }, @@ -61,7 +61,7 @@ Program { implements: [], superClass: null, - range: [0, 31], + range: [0, 32], loc: { start: { column: 0, line: 1 }, end: { column: 1, line: 3 }, @@ -70,7 +70,7 @@ Program { ], sourceType: "script", - range: [0, 32], + range: [0, 33], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 4 }, diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot index a127e69a02b0..d587dd5c180d 100644 --- a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot @@ -59,11 +59,21 @@ end: { column: 17, line: 2 }, }, }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [29, 30], + loc: { + start: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, Punctuator { type: "Punctuator", value: "}", - range: [30, 31], + range: [31, 32], loc: { start: { column: 0, line: 3 }, end: { column: 1, line: 3 }, diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot index 5423ced56ba9..a35a705153a3 100644 --- a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot @@ -30,15 +30,15 @@ Program { static: false, value: null, - range: [14, 29], + range: [14, 30], loc: { start: { column: 2, line: 2 }, - end: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, }, }, ], - range: [10, 31], + range: [10, 32], loc: { start: { column: 10, line: 1 }, end: { column: 1, line: 3 }, @@ -61,7 +61,7 @@ Program { implements: [], superClass: null, - range: [0, 31], + range: [0, 32], loc: { start: { column: 0, line: 1 }, end: { column: 1, line: 3 }, @@ -70,7 +70,7 @@ Program { ], sourceType: "script", - range: [0, 32], + range: [0, 33], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 4 }, diff --git a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot index a127e69a02b0..d587dd5c180d 100644 --- a/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/element/PropertyDefinition/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot @@ -59,11 +59,21 @@ end: { column: 17, line: 2 }, }, }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [29, 30], + loc: { + start: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, Punctuator { type: "Punctuator", value: "}", - range: [30, 31], + range: [31, 32], loc: { start: { column: 0, line: 3 }, end: { column: 1, line: 3 }, diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/fixture.ts b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/fixture.ts index 9289b067bfe8..e267f66d845d 100644 --- a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/fixture.ts +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/fixture.ts @@ -1,3 +1,3 @@ abstract class Foo { - accessor [constructor] + accessor [constructor]; } diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot index 4dfbf670302b..82d28f21758a 100644 --- a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot @@ -31,15 +31,15 @@ Program { static: false, value: null, - range: [23, 45], + range: [23, 46], loc: { start: { column: 2, line: 2 }, - end: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, }, }, ], - range: [19, 47], + range: [19, 48], loc: { start: { column: 19, line: 1 }, end: { column: 1, line: 3 }, @@ -62,7 +62,7 @@ Program { implements: [], superClass: null, - range: [0, 47], + range: [0, 48], loc: { start: { column: 0, line: 1 }, end: { column: 1, line: 3 }, @@ -71,7 +71,7 @@ Program { ], sourceType: "script", - range: [0, 48], + range: [0, 49], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 4 }, diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot index f183c6bedce8..4941bcdc220c 100644 --- a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot @@ -79,11 +79,21 @@ end: { column: 24, line: 2 }, }, }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [45, 46], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, Punctuator { type: "Punctuator", value: "}", - range: [46, 47], + range: [47, 48], loc: { start: { column: 0, line: 3 }, end: { column: 1, line: 3 }, diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot index 4dfbf670302b..82d28f21758a 100644 --- a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot @@ -31,15 +31,15 @@ Program { static: false, value: null, - range: [23, 45], + range: [23, 46], loc: { start: { column: 2, line: 2 }, - end: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, }, }, ], - range: [19, 47], + range: [19, 48], loc: { start: { column: 19, line: 1 }, end: { column: 1, line: 3 }, @@ -62,7 +62,7 @@ Program { implements: [], superClass: null, - range: [0, 47], + range: [0, 48], loc: { start: { column: 0, line: 1 }, end: { column: 1, line: 3 }, @@ -71,7 +71,7 @@ Program { ], sourceType: "script", - range: [0, 48], + range: [0, 49], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 4 }, diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot index f183c6bedce8..4941bcdc220c 100644 --- a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot @@ -79,11 +79,21 @@ end: { column: 24, line: 2 }, }, }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [45, 46], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, Punctuator { type: "Punctuator", value: "}", - range: [46, 47], + range: [47, 48], loc: { start: { column: 0, line: 3 }, end: { column: 1, line: 3 }, diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/fixture.ts b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/fixture.ts index 2671ed1cd445..dd4af2978b06 100644 --- a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/fixture.ts +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/fixture.ts @@ -1,3 +1,3 @@ abstract class Foo { - accessor ['constructor'] + accessor ['constructor']; } diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot index 75031f7f1e88..c1ef23b02e88 100644 --- a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot @@ -30,15 +30,15 @@ Program { static: false, value: null, - range: [23, 47], + range: [23, 48], loc: { start: { column: 2, line: 2 }, - end: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, }, }, ], - range: [19, 49], + range: [19, 50], loc: { start: { column: 19, line: 1 }, end: { column: 1, line: 3 }, @@ -61,7 +61,7 @@ Program { implements: [], superClass: null, - range: [0, 49], + range: [0, 50], loc: { start: { column: 0, line: 1 }, end: { column: 1, line: 3 }, @@ -70,7 +70,7 @@ Program { ], sourceType: "script", - range: [0, 50], + range: [0, 51], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 4 }, diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot index a9d42164d739..b3c97ec3fd6c 100644 --- a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot @@ -79,11 +79,21 @@ end: { column: 26, line: 2 }, }, }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [47, 48], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, Punctuator { type: "Punctuator", value: "}", - range: [48, 49], + range: [49, 50], loc: { start: { column: 0, line: 3 }, end: { column: 1, line: 3 }, diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot index 75031f7f1e88..c1ef23b02e88 100644 --- a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot @@ -30,15 +30,15 @@ Program { static: false, value: null, - range: [23, 47], + range: [23, 48], loc: { start: { column: 2, line: 2 }, - end: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, }, }, ], - range: [19, 49], + range: [19, 50], loc: { start: { column: 19, line: 1 }, end: { column: 1, line: 3 }, @@ -61,7 +61,7 @@ Program { implements: [], superClass: null, - range: [0, 49], + range: [0, 50], loc: { start: { column: 0, line: 1 }, end: { column: 1, line: 3 }, @@ -70,7 +70,7 @@ Program { ], sourceType: "script", - range: [0, 50], + range: [0, 51], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 4 }, diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot index a9d42164d739..b3c97ec3fd6c 100644 --- a/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot @@ -79,11 +79,21 @@ end: { column: 26, line: 2 }, }, }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [47, 48], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, Punctuator { type: "Punctuator", value: "}", - range: [48, 49], + range: [49, 50], loc: { start: { column: 0, line: 3 }, end: { column: 1, line: 3 }, diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/fixture.ts b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/fixture.ts index a4c2cc0e7547..0035d60f9a3b 100644 --- a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/fixture.ts +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/fixture.ts @@ -1,3 +1,3 @@ abstract class Foo { - [constructor] + [constructor]; } diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot index 3145f7caa799..a84556365ffa 100644 --- a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/1-TSESTree-AST.shot @@ -31,15 +31,15 @@ Program { static: false, value: null, - range: [23, 36], + range: [23, 37], loc: { start: { column: 2, line: 2 }, - end: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, }, }, ], - range: [19, 38], + range: [19, 39], loc: { start: { column: 19, line: 1 }, end: { column: 1, line: 3 }, @@ -62,7 +62,7 @@ Program { implements: [], superClass: null, - range: [0, 38], + range: [0, 39], loc: { start: { column: 0, line: 1 }, end: { column: 1, line: 3 }, @@ -71,7 +71,7 @@ Program { ], sourceType: "script", - range: [0, 39], + range: [0, 40], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 4 }, diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot index 931b669ee26f..f33b1b154313 100644 --- a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/2-TSESTree-Tokens.shot @@ -69,11 +69,21 @@ end: { column: 15, line: 2 }, }, }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [36, 37], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, Punctuator { type: "Punctuator", value: "}", - range: [37, 38], + range: [38, 39], loc: { start: { column: 0, line: 3 }, end: { column: 1, line: 3 }, diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot index 3145f7caa799..a84556365ffa 100644 --- a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/3-Babel-AST.shot @@ -31,15 +31,15 @@ Program { static: false, value: null, - range: [23, 36], + range: [23, 37], loc: { start: { column: 2, line: 2 }, - end: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, }, }, ], - range: [19, 38], + range: [19, 39], loc: { start: { column: 19, line: 1 }, end: { column: 1, line: 3 }, @@ -62,7 +62,7 @@ Program { implements: [], superClass: null, - range: [0, 38], + range: [0, 39], loc: { start: { column: 0, line: 1 }, end: { column: 1, line: 3 }, @@ -71,7 +71,7 @@ Program { ], sourceType: "script", - range: [0, 39], + range: [0, 40], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 4 }, diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot index 931b669ee26f..f33b1b154313 100644 --- a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-identifier-computed/snapshots/4-Babel-Tokens.shot @@ -69,11 +69,21 @@ end: { column: 15, line: 2 }, }, }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [36, 37], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, Punctuator { type: "Punctuator", value: "}", - range: [37, 38], + range: [38, 39], loc: { start: { column: 0, line: 3 }, end: { column: 1, line: 3 }, diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/fixture.ts b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/fixture.ts index 9d7976a8d2ed..d7fa2a53c79b 100644 --- a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/fixture.ts +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/fixture.ts @@ -1,3 +1,3 @@ abstract class Foo { - ['constructor'] + ['constructor']; } diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot index 6e69c4edb81b..880411e5b0a1 100644 --- a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/1-TSESTree-AST.shot @@ -30,15 +30,15 @@ Program { static: false, value: null, - range: [23, 38], + range: [23, 39], loc: { start: { column: 2, line: 2 }, - end: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, }, }, ], - range: [19, 40], + range: [19, 41], loc: { start: { column: 19, line: 1 }, end: { column: 1, line: 3 }, @@ -61,7 +61,7 @@ Program { implements: [], superClass: null, - range: [0, 40], + range: [0, 41], loc: { start: { column: 0, line: 1 }, end: { column: 1, line: 3 }, @@ -70,7 +70,7 @@ Program { ], sourceType: "script", - range: [0, 41], + range: [0, 42], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 4 }, diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot index 3e6d8e4dabf3..a82ebf95ff87 100644 --- a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/2-TSESTree-Tokens.shot @@ -69,11 +69,21 @@ end: { column: 17, line: 2 }, }, }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [38, 39], + loc: { + start: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, Punctuator { type: "Punctuator", value: "}", - range: [39, 40], + range: [40, 41], loc: { start: { column: 0, line: 3 }, end: { column: 1, line: 3 }, diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot index 6e69c4edb81b..880411e5b0a1 100644 --- a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/3-Babel-AST.shot @@ -30,15 +30,15 @@ Program { static: false, value: null, - range: [23, 38], + range: [23, 39], loc: { start: { column: 2, line: 2 }, - end: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, }, }, ], - range: [19, 40], + range: [19, 41], loc: { start: { column: 19, line: 1 }, end: { column: 1, line: 3 }, @@ -61,7 +61,7 @@ Program { implements: [], superClass: null, - range: [0, 40], + range: [0, 41], loc: { start: { column: 0, line: 1 }, end: { column: 1, line: 3 }, @@ -70,7 +70,7 @@ Program { ], sourceType: "script", - range: [0, 41], + range: [0, 42], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 4 }, diff --git a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot index 3e6d8e4dabf3..a82ebf95ff87 100644 --- a/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/element/TSAbstractPropertyDefinition/fixtures/key-constructor-string-computed/snapshots/4-Babel-Tokens.shot @@ -69,11 +69,21 @@ end: { column: 17, line: 2 }, }, }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [38, 39], + loc: { + start: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, Punctuator { type: "Punctuator", value: "}", - range: [39, 40], + range: [40, 41], loc: { start: { column: 0, line: 3 }, end: { column: 1, line: 3 },