From d448dccb9d58d8ca2fcb0e5263f85010a82b2ecb Mon Sep 17 00:00:00 2001 From: fisker Date: Mon, 13 Mar 2023 13:42:50 +0800 Subject: [PATCH 1/8] feat: throw errors when abstract property has initializer --- packages/typescript-estree/src/convert.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 53ffcabdbc1..4a757e3250a 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -1145,6 +1145,15 @@ export class Converter { const isAbstract = hasModifier(SyntaxKind.AbstractKeyword, node); const isAccessor = hasModifier(SyntaxKind.AccessorKeyword, node); + if (isAbstract && node.initializer) { + this.#throwError( + node.initializer, + `Property '${ts.declarationNameToString( + node.name, + )}' cannot have an initializer because it is marked abstract.`, + ); + } + // eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- TODO - add ignore IIFE option const type = (() => { if (isAccessor) { From 7c99b3aca1a1a9b7c9ac3beb0dcc2665bf810181 Mon Sep 17 00:00:00 2001 From: fisker Date: Mon, 13 Mar 2023 13:48:16 +0800 Subject: [PATCH 2/8] Don't use `ts.declarationNameToString` --- packages/typescript-estree/src/convert.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 4a757e3250a..bf70f21526f 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -1148,9 +1148,7 @@ export class Converter { if (isAbstract && node.initializer) { this.#throwError( node.initializer, - `Property '${ts.declarationNameToString( - node.name, - )}' cannot have an initializer because it is marked abstract.`, + `Abstract property cannot have an initializer.`, ); } From 2e604718113b3cd0fe77973f43175f6e20d1e034 Mon Sep 17 00:00:00 2001 From: fisker Date: Mon, 13 Mar 2023 14:02:27 +0800 Subject: [PATCH 3/8] Fix tests --- .../modifier-abstract-with-value/fixture.ts | 0 .../snapshots/1-Babel-AST.shot} | 0 .../snapshots/1-TSESTree-AST.shot | 0 .../snapshots/1-TSESTree-Error.shot | 10 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/2-Babel-Tokens.shot} | 0 .../snapshots/2-TSESTree-Tokens.shot | 0 .../snapshots/3-Alignment-Error.shot | 3 + .../snapshots/3-Babel-AST.shot | 99 +++++++++++++ .../snapshots/4-Babel-Tokens.shot | 136 ++++++++++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 0 .../snapshots/6-AST-Alignment-Tokens.shot | 0 .../snapshots/1-TSESTree-Error.shot | 10 +- .../snapshots/3-Alignment-Error.shot | 2 +- .../tests/fixtures-with-differences-ast.shot | 1 - .../fixtures-with-differences-errors.shot | 2 +- 16 files changed, 262 insertions(+), 4 deletions(-) rename packages/ast-spec/src/element/AccessorProperty/fixtures/{ => _error_}/modifier-abstract-with-value/fixture.ts (100%) rename packages/ast-spec/src/element/AccessorProperty/fixtures/{modifier-abstract-with-value/snapshots/3-Babel-AST.shot => _error_/modifier-abstract-with-value/snapshots/1-Babel-AST.shot} (100%) rename packages/ast-spec/src/element/AccessorProperty/fixtures/{ => _error_}/modifier-abstract-with-value/snapshots/1-TSESTree-AST.shot (100%) create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/2-Babel-Error.shot rename packages/ast-spec/src/element/AccessorProperty/fixtures/{modifier-abstract-with-value/snapshots/4-Babel-Tokens.shot => _error_/modifier-abstract-with-value/snapshots/2-Babel-Tokens.shot} (100%) rename packages/ast-spec/src/element/AccessorProperty/fixtures/{ => _error_}/modifier-abstract-with-value/snapshots/2-TSESTree-Tokens.shot (100%) create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/4-Babel-Tokens.shot rename packages/ast-spec/src/element/AccessorProperty/fixtures/{ => _error_}/modifier-abstract-with-value/snapshots/5-AST-Alignment-AST.shot (100%) rename packages/ast-spec/src/element/AccessorProperty/fixtures/{ => _error_}/modifier-abstract-with-value/snapshots/6-AST-Alignment-Tokens.shot (100%) diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/fixture.ts similarity index 100% rename from packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/fixture.ts rename to packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/fixture.ts diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/1-Babel-AST.shot similarity index 100% rename from packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/3-Babel-AST.shot rename to packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/1-Babel-AST.shot diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/1-TSESTree-AST.shot similarity index 100% rename from packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/1-TSESTree-AST.shot rename to packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/1-TSESTree-AST.shot diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..02bd0d44084 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,10 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-abstract-with-value TSESTree - Error 1`] = ` +"TSError + 1 | abstract class Foo { +> 2 | abstract accessor foo: number = 1; + | ^ Abstract property cannot have an initializer. + 3 | } + 4 |" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..5571da6592b --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-abstract-with-value Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/2-Babel-Tokens.shot similarity index 100% rename from packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/4-Babel-Tokens.shot rename to packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/2-Babel-Tokens.shot diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/2-TSESTree-Tokens.shot similarity index 100% rename from packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/2-TSESTree-Tokens.shot rename to packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/2-TSESTree-Tokens.shot diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..27f61e6299c --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-abstract-with-value Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..147bdd6cb25 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/3-Babel-AST.shot @@ -0,0 +1,99 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: true, + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + abstract: true, + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [41, 44], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + static: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [46, 52], + loc: { + start: { column: 25, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + + range: [44, 52], + loc: { + start: { column: 23, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + value: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [55, 56], + loc: { + start: { column: 34, line: 2 }, + end: { column: 35, line: 2 }, + }, + }, + + range: [23, 57], + loc: { + start: { column: 2, line: 2 }, + end: { column: 36, line: 2 }, + }, + }, + ], + + range: [19, 59], + loc: { + start: { column: 19, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + superClass: null, + + range: [0, 59], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 60], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..1d49b0c7ad1 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,136 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value Babel - Tokens 1`] = ` +Array [ + 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: "abstract", + + range: [23, 31], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [32, 40], + loc: { + start: { column: 11, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [41, 44], + loc: { + start: { column: 20, 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + range: [46, 52], + loc: { + start: { column: 25, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [53, 54], + loc: { + start: { column: 32, line: 2 }, + end: { column: 33, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [55, 56], + loc: { + start: { column: 34, line: 2 }, + end: { column: 35, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [56, 57], + loc: { + start: { column: 35, line: 2 }, + end: { column: 36, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [58, 59], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/5-AST-Alignment-AST.shot similarity index 100% rename from packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/5-AST-Alignment-AST.shot rename to packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/5-AST-Alignment-AST.shot diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/6-AST-Alignment-Tokens.shot similarity index 100% rename from packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/6-AST-Alignment-Tokens.shot rename to packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/6-AST-Alignment-Tokens.shot diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/snapshots/1-TSESTree-Error.shot index 8afa44f7c60..2c3eef0e00a 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures basics _error_ abstract-class-with-override-property TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures basics _error_ abstract-class-with-override-property TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | abstract class SpecializedComponent extends SomeComponent { +> 4 | abstract override foo = 1; + | ^ Abstract property cannot have an initializer. + 5 | } + 6 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/snapshots/3-Alignment-Error.shot index 6de99caccfc..6afce871c92 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures basics _error_ abstract-class-with-override-property Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures basics _error_ abstract-class-with-override-property Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/tests/fixtures-with-differences-ast.shot b/packages/ast-spec/tests/fixtures-with-differences-ast.shot index e593f0263e9..fcccac7ccd4 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-ast.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-ast.shot @@ -103,7 +103,6 @@ Set { "element/AccessorProperty/fixtures/key-number/fixture.ts", "element/AccessorProperty/fixtures/key-private/fixture.ts", "element/AccessorProperty/fixtures/key-string/fixture.ts", - "element/AccessorProperty/fixtures/modifier-abstract-with-value/fixture.ts", "element/AccessorProperty/fixtures/modifier-abstract/fixture.ts", "element/AccessorProperty/fixtures/modifier-declare/fixture.ts", "element/AccessorProperty/fixtures/modifier-override/fixture.ts", diff --git a/packages/ast-spec/tests/fixtures-with-differences-errors.shot b/packages/ast-spec/tests/fixtures-with-differences-errors.shot index ebfccb431af..ea471610ce9 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-errors.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-errors.shot @@ -21,7 +21,6 @@ Object { "declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/fixture.ts", "element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-static-constructor/fixture.ts", - "legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/abstract-interface/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/await-without-async-function/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/class-private-identifier-field-with-accessibility-error/fixture.ts", @@ -71,6 +70,7 @@ Object { "TSESTree errored but Babel didn't": Set { "declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/fixture.ts", "declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/fixture.ts", + "element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/fixture.ts", "legacy-fixtures/expressions/fixtures/_error_/instantiation-expression/fixture.ts", }, } From b7ff5ba97652ee5deb04b82b731afabc85e4ef32 Mon Sep 17 00:00:00 2001 From: fisker Date: Mon, 13 Mar 2023 14:13:01 +0800 Subject: [PATCH 4/8] Tests --- .../fixture.ts | 0 .../snapshots/1-Babel-AST.shot | 0 .../snapshots/1-TSESTree-AST.shot | 0 .../snapshots/1-TSESTree-Error.shot | 2 +- .../snapshots/2-Babel-Error.shot | 2 +- .../snapshots/2-Babel-Tokens.shot | 0 .../snapshots/2-TSESTree-Tokens.shot | 0 .../snapshots/3-Alignment-Error.shot | 3 + .../snapshots/3-Babel-AST.shot | 0 .../snapshots/4-Babel-Tokens.shot | 0 .../snapshots/5-AST-Alignment-AST.shot | 0 .../snapshots/6-AST-Alignment-Tokens.shot | 0 .../fixture.ts | 3 + .../snapshots/1-Babel-AST.shot | 99 +++++++++++++ .../snapshots/1-TSESTree-AST.shot | 101 +++++++++++++ .../snapshots/1-TSESTree-Error.shot | 10 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/2-Babel-Tokens.shot | 136 ++++++++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 136 ++++++++++++++++++ .../snapshots/3-Alignment-Error.shot | 2 +- .../snapshots/3-Babel-AST.shot | 99 +++++++++++++ .../snapshots/4-Babel-Tokens.shot | 136 ++++++++++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 119 +++++++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures-with-differences-errors.shot | 2 +- 25 files changed, 855 insertions(+), 4 deletions(-) rename packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/{modifier-abstract-with-value => modifier-abstract-accessor-with-value}/fixture.ts (100%) rename packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/{modifier-abstract-with-value => modifier-abstract-accessor-with-value}/snapshots/1-Babel-AST.shot (100%) rename packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/{modifier-abstract-with-value => modifier-abstract-accessor-with-value}/snapshots/1-TSESTree-AST.shot (100%) rename packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/{modifier-abstract-with-value => modifier-abstract-accessor-with-value}/snapshots/1-TSESTree-Error.shot (84%) rename packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/{modifier-abstract-with-value => modifier-abstract-accessor-with-value}/snapshots/2-Babel-Error.shot (63%) rename packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/{modifier-abstract-with-value => modifier-abstract-accessor-with-value}/snapshots/2-Babel-Tokens.shot (100%) rename packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/{modifier-abstract-with-value => modifier-abstract-accessor-with-value}/snapshots/2-TSESTree-Tokens.shot (100%) create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/3-Alignment-Error.shot rename packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/{modifier-abstract-with-value => modifier-abstract-accessor-with-value}/snapshots/3-Babel-AST.shot (100%) rename packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/{modifier-abstract-with-value => modifier-abstract-accessor-with-value}/snapshots/4-Babel-Tokens.shot (100%) rename packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/{modifier-abstract-with-value => modifier-abstract-accessor-with-value}/snapshots/5-AST-Alignment-AST.shot (100%) rename packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/{modifier-abstract-with-value => modifier-abstract-accessor-with-value}/snapshots/6-AST-Alignment-Tokens.shot (100%) create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/fixture.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/1-Babel-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-TSESTree-Tokens.shot rename packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/{modifier-abstract-with-value => modifier-abstract-property-with-value}/snapshots/3-Alignment-Error.shot (57%) create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/6-AST-Alignment-Tokens.shot diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/fixture.ts similarity index 100% rename from packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/fixture.ts rename to packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/fixture.ts diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/1-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/1-Babel-AST.shot similarity index 100% rename from packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/1-Babel-AST.shot rename to packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/1-Babel-AST.shot diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/1-TSESTree-AST.shot similarity index 100% rename from packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/1-TSESTree-AST.shot rename to packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/1-TSESTree-AST.shot diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/1-TSESTree-Error.shot similarity index 84% rename from packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/1-TSESTree-Error.shot rename to packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/1-TSESTree-Error.shot index 02bd0d44084..77e891766df 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/1-TSESTree-Error.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures element AccessorProperty _error_ modifier-abstract-with-value TSESTree - Error 1`] = ` +exports[`AST Fixtures element AccessorProperty _error_ modifier-abstract-accessor-with-value TSESTree - Error 1`] = ` "TSError 1 | abstract class Foo { > 2 | abstract accessor foo: number = 1; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/2-Babel-Error.shot similarity index 63% rename from packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/2-Babel-Error.shot rename to packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/2-Babel-Error.shot index 5571da6592b..f314b35255b 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/2-Babel-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures element AccessorProperty _error_ modifier-abstract-with-value Babel - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures element AccessorProperty _error_ modifier-abstract-accessor-with-value Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/2-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/2-Babel-Tokens.shot similarity index 100% rename from packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/2-Babel-Tokens.shot rename to packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/2-Babel-Tokens.shot diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/2-TSESTree-Tokens.shot similarity index 100% rename from packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/2-TSESTree-Tokens.shot rename to packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/2-TSESTree-Tokens.shot diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..f248419e4f7 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-abstract-accessor-with-value Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/3-Babel-AST.shot similarity index 100% rename from packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/3-Babel-AST.shot rename to packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/3-Babel-AST.shot diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/4-Babel-Tokens.shot similarity index 100% rename from packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/4-Babel-Tokens.shot rename to packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/4-Babel-Tokens.shot diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/5-AST-Alignment-AST.shot similarity index 100% rename from packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/5-AST-Alignment-AST.shot rename to packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/5-AST-Alignment-AST.shot diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/6-AST-Alignment-Tokens.shot similarity index 100% rename from packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/6-AST-Alignment-Tokens.shot rename to packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/6-AST-Alignment-Tokens.shot diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/fixture.ts new file mode 100644 index 00000000000..de0095c3531 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + abstract property = 1; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/1-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/1-Babel-AST.shot new file mode 100644 index 00000000000..147bdd6cb25 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/1-Babel-AST.shot @@ -0,0 +1,99 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: true, + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + abstract: true, + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [41, 44], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + static: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [46, 52], + loc: { + start: { column: 25, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + + range: [44, 52], + loc: { + start: { column: 23, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + value: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [55, 56], + loc: { + start: { column: 34, line: 2 }, + end: { column: 35, line: 2 }, + }, + }, + + range: [23, 57], + loc: { + start: { column: 2, line: 2 }, + end: { column: 36, line: 2 }, + }, + }, + ], + + range: [19, 59], + loc: { + start: { column: 19, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + superClass: null, + + range: [0, 59], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 60], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..131625db754 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,101 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: true, + body: ClassBody { + type: "ClassBody", + body: Array [ + TSAbstractAccessorProperty { + type: "TSAbstractAccessorProperty", + computed: false, + declare: false, + decorators: Array [], + definite: false, + key: Identifier { + type: "Identifier", + decorators: Array [], + name: "foo", + optional: false, + + range: [41, 44], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [46, 52], + loc: { + start: { column: 25, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + + range: [44, 52], + loc: { + start: { column: 23, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + value: null, + + range: [23, 57], + loc: { + start: { column: 2, line: 2 }, + end: { column: 36, line: 2 }, + }, + }, + ], + + range: [19, 59], + loc: { + start: { column: 19, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: Array [], + id: Identifier { + type: "Identifier", + decorators: Array [], + name: "Foo", + optional: false, + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + implements: Array [], + superClass: null, + + range: [0, 59], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 60], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..8fc5278de62 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,10 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-abstract-property-with-value TSESTree - Error 1`] = ` +"TSError + 1 | abstract class Foo { +> 2 | abstract property = 1; + | ^ Abstract property cannot have an initializer. + 3 | } + 4 |" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..24fbc900989 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-abstract-property-with-value Babel - Error 1`] = `[SyntaxError: Property 'property' cannot have an initializer because it is marked abstract. (2:20)]`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-Babel-Tokens.shot new file mode 100644 index 00000000000..1d49b0c7ad1 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-Babel-Tokens.shot @@ -0,0 +1,136 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value Babel - Tokens 1`] = ` +Array [ + 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: "abstract", + + range: [23, 31], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [32, 40], + loc: { + start: { column: 11, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [41, 44], + loc: { + start: { column: 20, 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + range: [46, 52], + loc: { + start: { column: 25, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [53, 54], + loc: { + start: { column: 32, line: 2 }, + end: { column: 33, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [55, 56], + loc: { + start: { column: 34, line: 2 }, + end: { column: 35, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [56, 57], + loc: { + start: { column: 35, line: 2 }, + end: { column: 36, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [58, 59], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..b993bfecdea --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,136 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value TSESTree - Tokens 1`] = ` +Array [ + 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: "abstract", + + range: [23, 31], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [32, 40], + loc: { + start: { column: 11, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [41, 44], + loc: { + start: { column: 20, 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + range: [46, 52], + loc: { + start: { column: 25, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [53, 54], + loc: { + start: { column: 32, line: 2 }, + end: { column: 33, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [55, 56], + loc: { + start: { column: 34, line: 2 }, + end: { column: 35, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [56, 57], + loc: { + start: { column: 35, line: 2 }, + end: { column: 36, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [58, 59], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/3-Alignment-Error.shot similarity index 57% rename from packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/3-Alignment-Error.shot rename to packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/3-Alignment-Error.shot index 27f61e6299c..137837e3e8f 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures element AccessorProperty _error_ modifier-abstract-with-value Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; +exports[`AST Fixtures element AccessorProperty _error_ modifier-abstract-property-with-value Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..147bdd6cb25 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/3-Babel-AST.shot @@ -0,0 +1,99 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: true, + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + abstract: true, + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [41, 44], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + static: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [46, 52], + loc: { + start: { column: 25, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + + range: [44, 52], + loc: { + start: { column: 23, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + value: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [55, 56], + loc: { + start: { column: 34, line: 2 }, + end: { column: 35, line: 2 }, + }, + }, + + range: [23, 57], + loc: { + start: { column: 2, line: 2 }, + end: { column: 36, line: 2 }, + }, + }, + ], + + range: [19, 59], + loc: { + start: { column: 19, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + superClass: null, + + range: [0, 59], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 60], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..1d49b0c7ad1 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,136 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value Babel - Tokens 1`] = ` +Array [ + 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: "abstract", + + range: [23, 31], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [32, 40], + loc: { + start: { column: 11, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [41, 44], + loc: { + start: { column: 20, 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + range: [46, 52], + loc: { + start: { column: 25, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [53, 54], + loc: { + start: { column: 32, line: 2 }, + end: { column: 33, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [55, 56], + loc: { + start: { column: 34, line: 2 }, + end: { column: 35, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [56, 57], + loc: { + start: { column: 35, line: 2 }, + end: { column: 36, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [58, 59], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..957a65859f2 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,119 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + abstract: true, + body: ClassBody { + type: 'ClassBody', + body: Array [ +- TSAbstractAccessorProperty { +- type: 'TSAbstractAccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', ++ abstract: true, + computed: false, +- declare: false, +- decorators: Array [], +- definite: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [41, 44], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, +- optional: false, +- override: false, +- readonly: false, + static: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [46, 52], + loc: { + start: { column: 25, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + + range: [44, 52], + loc: { + start: { column: 23, line: 2 }, + end: { column: 31, line: 2 }, ++ }, ++ }, ++ value: Literal { ++ type: 'Literal', ++ raw: '1', ++ value: 1, ++ ++ range: [55, 56], ++ loc: { ++ start: { column: 34, line: 2 }, ++ end: { column: 35, line: 2 }, + }, + }, +- value: null, + + range: [23, 57], + loc: { + start: { column: 2, line: 2 }, + end: { column: 36, line: 2 }, + }, + }, + ], + + range: [19, 59], + loc: { + start: { column: 19, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, +- declare: false, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [0, 59], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 60], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..fd832b249e4 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/tests/fixtures-with-differences-errors.shot b/packages/ast-spec/tests/fixtures-with-differences-errors.shot index ea471610ce9..cc44e15b507 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-errors.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-errors.shot @@ -70,7 +70,7 @@ Object { "TSESTree errored but Babel didn't": Set { "declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/fixture.ts", "declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/fixture.ts", - "element/AccessorProperty/fixtures/_error_/modifier-abstract-with-value/fixture.ts", + "element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/fixture.ts", "legacy-fixtures/expressions/fixtures/_error_/instantiation-expression/fixture.ts", }, } From a1da08a595ac9d390ebbdce505baa05adad102b8 Mon Sep 17 00:00:00 2001 From: fisker Date: Mon, 13 Mar 2023 14:24:59 +0800 Subject: [PATCH 5/8] Fix snapshots --- .../snapshots/1-Babel-AST.shot | 99 ------------- .../snapshots/1-TSESTree-AST.shot | 101 ------------- .../snapshots/2-Babel-Tokens.shot | 136 ------------------ .../snapshots/2-TSESTree-Tokens.shot | 136 ------------------ .../snapshots/3-Babel-AST.shot | 99 ------------- .../snapshots/4-Babel-Tokens.shot | 136 ------------------ .../snapshots/5-AST-Alignment-AST.shot | 119 --------------- .../snapshots/6-AST-Alignment-Tokens.shot | 6 - .../snapshots/1-Babel-AST.shot | 99 ------------- .../snapshots/1-TSESTree-AST.shot | 101 ------------- .../snapshots/2-Babel-Tokens.shot | 136 ------------------ .../snapshots/2-TSESTree-Tokens.shot | 136 ------------------ .../snapshots/3-Babel-AST.shot | 99 ------------- .../snapshots/4-Babel-Tokens.shot | 136 ------------------ .../snapshots/5-AST-Alignment-AST.shot | 119 --------------- .../snapshots/6-AST-Alignment-Tokens.shot | 6 - 16 files changed, 1664 deletions(-) delete mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/1-Babel-AST.shot delete mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/1-TSESTree-AST.shot delete mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/2-Babel-Tokens.shot delete mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/2-TSESTree-Tokens.shot delete mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/3-Babel-AST.shot delete mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/4-Babel-Tokens.shot delete mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/5-AST-Alignment-AST.shot delete mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/6-AST-Alignment-Tokens.shot delete mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/1-Babel-AST.shot delete mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/1-TSESTree-AST.shot delete mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-Babel-Tokens.shot delete mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-TSESTree-Tokens.shot delete mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/3-Babel-AST.shot delete mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/4-Babel-Tokens.shot delete mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/5-AST-Alignment-AST.shot delete mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/6-AST-Alignment-Tokens.shot diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/1-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/1-Babel-AST.shot deleted file mode 100644 index 147bdd6cb25..00000000000 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/1-Babel-AST.shot +++ /dev/null @@ -1,99 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value Babel - AST 1`] = ` -Program { - type: "Program", - body: Array [ - ClassDeclaration { - type: "ClassDeclaration", - abstract: true, - body: ClassBody { - type: "ClassBody", - body: Array [ - ClassAccessorProperty { - type: "ClassAccessorProperty", - abstract: true, - computed: false, - key: Identifier { - type: "Identifier", - name: "foo", - - range: [41, 44], - loc: { - start: { column: 20, line: 2 }, - end: { column: 23, line: 2 }, - }, - }, - static: false, - typeAnnotation: TSTypeAnnotation { - type: "TSTypeAnnotation", - typeAnnotation: TSNumberKeyword { - type: "TSNumberKeyword", - - range: [46, 52], - loc: { - start: { column: 25, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, - - range: [44, 52], - loc: { - start: { column: 23, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, - value: Literal { - type: "Literal", - raw: "1", - value: 1, - - range: [55, 56], - loc: { - start: { column: 34, line: 2 }, - end: { column: 35, line: 2 }, - }, - }, - - range: [23, 57], - loc: { - start: { column: 2, line: 2 }, - end: { column: 36, line: 2 }, - }, - }, - ], - - range: [19, 59], - loc: { - start: { column: 19, line: 1 }, - end: { column: 1, line: 3 }, - }, - }, - id: Identifier { - type: "Identifier", - name: "Foo", - - range: [15, 18], - loc: { - start: { column: 15, line: 1 }, - end: { column: 18, line: 1 }, - }, - }, - superClass: null, - - range: [0, 59], - loc: { - start: { column: 0, line: 1 }, - end: { column: 1, line: 3 }, - }, - }, - ], - sourceType: "script", - - range: [0, 60], - loc: { - start: { column: 0, line: 1 }, - end: { column: 0, line: 4 }, - }, -} -`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/1-TSESTree-AST.shot deleted file mode 100644 index 131625db754..00000000000 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/1-TSESTree-AST.shot +++ /dev/null @@ -1,101 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value TSESTree - AST 1`] = ` -Program { - type: "Program", - body: Array [ - ClassDeclaration { - type: "ClassDeclaration", - abstract: true, - body: ClassBody { - type: "ClassBody", - body: Array [ - TSAbstractAccessorProperty { - type: "TSAbstractAccessorProperty", - computed: false, - declare: false, - decorators: Array [], - definite: false, - key: Identifier { - type: "Identifier", - decorators: Array [], - name: "foo", - optional: false, - - range: [41, 44], - loc: { - start: { column: 20, line: 2 }, - end: { column: 23, line: 2 }, - }, - }, - optional: false, - override: false, - readonly: false, - static: false, - typeAnnotation: TSTypeAnnotation { - type: "TSTypeAnnotation", - typeAnnotation: TSNumberKeyword { - type: "TSNumberKeyword", - - range: [46, 52], - loc: { - start: { column: 25, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, - - range: [44, 52], - loc: { - start: { column: 23, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, - value: null, - - range: [23, 57], - loc: { - start: { column: 2, line: 2 }, - end: { column: 36, line: 2 }, - }, - }, - ], - - range: [19, 59], - loc: { - start: { column: 19, line: 1 }, - end: { column: 1, line: 3 }, - }, - }, - declare: false, - decorators: Array [], - id: Identifier { - type: "Identifier", - decorators: Array [], - name: "Foo", - optional: false, - - range: [15, 18], - loc: { - start: { column: 15, line: 1 }, - end: { column: 18, line: 1 }, - }, - }, - implements: Array [], - superClass: null, - - range: [0, 59], - loc: { - start: { column: 0, line: 1 }, - end: { column: 1, line: 3 }, - }, - }, - ], - sourceType: "script", - - range: [0, 60], - loc: { - start: { column: 0, line: 1 }, - end: { column: 0, line: 4 }, - }, -} -`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/2-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/2-Babel-Tokens.shot deleted file mode 100644 index 1d49b0c7ad1..00000000000 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/2-Babel-Tokens.shot +++ /dev/null @@ -1,136 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value Babel - Tokens 1`] = ` -Array [ - 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: "abstract", - - range: [23, 31], - loc: { - start: { column: 2, line: 2 }, - end: { column: 10, line: 2 }, - }, - }, - Identifier { - type: "Identifier", - value: "accessor", - - range: [32, 40], - loc: { - start: { column: 11, line: 2 }, - end: { column: 19, line: 2 }, - }, - }, - Identifier { - type: "Identifier", - value: "foo", - - range: [41, 44], - loc: { - start: { column: 20, 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 }, - }, - }, - Identifier { - type: "Identifier", - value: "number", - - range: [46, 52], - loc: { - start: { column: 25, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "=", - - range: [53, 54], - loc: { - start: { column: 32, line: 2 }, - end: { column: 33, line: 2 }, - }, - }, - Numeric { - type: "Numeric", - value: "1", - - range: [55, 56], - loc: { - start: { column: 34, line: 2 }, - end: { column: 35, line: 2 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ";", - - range: [56, 57], - loc: { - start: { column: 35, line: 2 }, - end: { column: 36, line: 2 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "}", - - range: [58, 59], - loc: { - start: { column: 0, line: 3 }, - end: { column: 1, line: 3 }, - }, - }, -] -`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/2-TSESTree-Tokens.shot deleted file mode 100644 index b993bfecdea..00000000000 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/2-TSESTree-Tokens.shot +++ /dev/null @@ -1,136 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value TSESTree - Tokens 1`] = ` -Array [ - 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: "abstract", - - range: [23, 31], - loc: { - start: { column: 2, line: 2 }, - end: { column: 10, line: 2 }, - }, - }, - Identifier { - type: "Identifier", - value: "accessor", - - range: [32, 40], - loc: { - start: { column: 11, line: 2 }, - end: { column: 19, line: 2 }, - }, - }, - Identifier { - type: "Identifier", - value: "foo", - - range: [41, 44], - loc: { - start: { column: 20, 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 }, - }, - }, - Identifier { - type: "Identifier", - value: "number", - - range: [46, 52], - loc: { - start: { column: 25, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "=", - - range: [53, 54], - loc: { - start: { column: 32, line: 2 }, - end: { column: 33, line: 2 }, - }, - }, - Numeric { - type: "Numeric", - value: "1", - - range: [55, 56], - loc: { - start: { column: 34, line: 2 }, - end: { column: 35, line: 2 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ";", - - range: [56, 57], - loc: { - start: { column: 35, line: 2 }, - end: { column: 36, line: 2 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "}", - - range: [58, 59], - loc: { - start: { column: 0, line: 3 }, - end: { column: 1, line: 3 }, - }, - }, -] -`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/3-Babel-AST.shot deleted file mode 100644 index 147bdd6cb25..00000000000 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/3-Babel-AST.shot +++ /dev/null @@ -1,99 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value Babel - AST 1`] = ` -Program { - type: "Program", - body: Array [ - ClassDeclaration { - type: "ClassDeclaration", - abstract: true, - body: ClassBody { - type: "ClassBody", - body: Array [ - ClassAccessorProperty { - type: "ClassAccessorProperty", - abstract: true, - computed: false, - key: Identifier { - type: "Identifier", - name: "foo", - - range: [41, 44], - loc: { - start: { column: 20, line: 2 }, - end: { column: 23, line: 2 }, - }, - }, - static: false, - typeAnnotation: TSTypeAnnotation { - type: "TSTypeAnnotation", - typeAnnotation: TSNumberKeyword { - type: "TSNumberKeyword", - - range: [46, 52], - loc: { - start: { column: 25, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, - - range: [44, 52], - loc: { - start: { column: 23, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, - value: Literal { - type: "Literal", - raw: "1", - value: 1, - - range: [55, 56], - loc: { - start: { column: 34, line: 2 }, - end: { column: 35, line: 2 }, - }, - }, - - range: [23, 57], - loc: { - start: { column: 2, line: 2 }, - end: { column: 36, line: 2 }, - }, - }, - ], - - range: [19, 59], - loc: { - start: { column: 19, line: 1 }, - end: { column: 1, line: 3 }, - }, - }, - id: Identifier { - type: "Identifier", - name: "Foo", - - range: [15, 18], - loc: { - start: { column: 15, line: 1 }, - end: { column: 18, line: 1 }, - }, - }, - superClass: null, - - range: [0, 59], - loc: { - start: { column: 0, line: 1 }, - end: { column: 1, line: 3 }, - }, - }, - ], - sourceType: "script", - - range: [0, 60], - loc: { - start: { column: 0, line: 1 }, - end: { column: 0, line: 4 }, - }, -} -`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/4-Babel-Tokens.shot deleted file mode 100644 index 1d49b0c7ad1..00000000000 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/4-Babel-Tokens.shot +++ /dev/null @@ -1,136 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value Babel - Tokens 1`] = ` -Array [ - 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: "abstract", - - range: [23, 31], - loc: { - start: { column: 2, line: 2 }, - end: { column: 10, line: 2 }, - }, - }, - Identifier { - type: "Identifier", - value: "accessor", - - range: [32, 40], - loc: { - start: { column: 11, line: 2 }, - end: { column: 19, line: 2 }, - }, - }, - Identifier { - type: "Identifier", - value: "foo", - - range: [41, 44], - loc: { - start: { column: 20, 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 }, - }, - }, - Identifier { - type: "Identifier", - value: "number", - - range: [46, 52], - loc: { - start: { column: 25, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "=", - - range: [53, 54], - loc: { - start: { column: 32, line: 2 }, - end: { column: 33, line: 2 }, - }, - }, - Numeric { - type: "Numeric", - value: "1", - - range: [55, 56], - loc: { - start: { column: 34, line: 2 }, - end: { column: 35, line: 2 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ";", - - range: [56, 57], - loc: { - start: { column: 35, line: 2 }, - end: { column: 36, line: 2 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "}", - - range: [58, 59], - loc: { - start: { column: 0, line: 3 }, - end: { column: 1, line: 3 }, - }, - }, -] -`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/5-AST-Alignment-AST.shot deleted file mode 100644 index 957a65859f2..00000000000 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/5-AST-Alignment-AST.shot +++ /dev/null @@ -1,119 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value AST Alignment - AST 1`] = ` -"Snapshot Diff: -- TSESTree -+ Babel - - Program { - type: 'Program', - body: Array [ - ClassDeclaration { - type: 'ClassDeclaration', - abstract: true, - body: ClassBody { - type: 'ClassBody', - body: Array [ -- TSAbstractAccessorProperty { -- type: 'TSAbstractAccessorProperty', -+ ClassAccessorProperty { -+ type: 'ClassAccessorProperty', -+ abstract: true, - computed: false, -- declare: false, -- decorators: Array [], -- definite: false, - key: Identifier { - type: 'Identifier', -- decorators: Array [], - name: 'foo', -- optional: false, - - range: [41, 44], - loc: { - start: { column: 20, line: 2 }, - end: { column: 23, line: 2 }, - }, - }, -- optional: false, -- override: false, -- readonly: false, - static: false, - typeAnnotation: TSTypeAnnotation { - type: 'TSTypeAnnotation', - typeAnnotation: TSNumberKeyword { - type: 'TSNumberKeyword', - - range: [46, 52], - loc: { - start: { column: 25, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, - - range: [44, 52], - loc: { - start: { column: 23, line: 2 }, - end: { column: 31, line: 2 }, -+ }, -+ }, -+ value: Literal { -+ type: 'Literal', -+ raw: '1', -+ value: 1, -+ -+ range: [55, 56], -+ loc: { -+ start: { column: 34, line: 2 }, -+ end: { column: 35, line: 2 }, - }, - }, -- value: null, - - range: [23, 57], - loc: { - start: { column: 2, line: 2 }, - end: { column: 36, line: 2 }, - }, - }, - ], - - range: [19, 59], - loc: { - start: { column: 19, line: 1 }, - end: { column: 1, line: 3 }, - }, - }, -- declare: false, -- decorators: Array [], - id: Identifier { - type: 'Identifier', -- decorators: Array [], - name: 'Foo', -- optional: false, - - range: [15, 18], - loc: { - start: { column: 15, line: 1 }, - end: { column: 18, line: 1 }, - }, - }, -- implements: Array [], - superClass: null, - - range: [0, 59], - loc: { - start: { column: 0, line: 1 }, - end: { column: 1, line: 3 }, - }, - }, - ], - sourceType: 'script', - - range: [0, 60], - loc: { - start: { column: 0, line: 1 }, - end: { column: 0, line: 4 }, - }, - }" -`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/6-AST-Alignment-Tokens.shot deleted file mode 100644 index fd832b249e4..00000000000 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/6-AST-Alignment-Tokens.shot +++ /dev/null @@ -1,6 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value AST Alignment - Token 1`] = ` -"Snapshot Diff: -Compared values have no visual difference." -`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/1-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/1-Babel-AST.shot deleted file mode 100644 index 147bdd6cb25..00000000000 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/1-Babel-AST.shot +++ /dev/null @@ -1,99 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value Babel - AST 1`] = ` -Program { - type: "Program", - body: Array [ - ClassDeclaration { - type: "ClassDeclaration", - abstract: true, - body: ClassBody { - type: "ClassBody", - body: Array [ - ClassAccessorProperty { - type: "ClassAccessorProperty", - abstract: true, - computed: false, - key: Identifier { - type: "Identifier", - name: "foo", - - range: [41, 44], - loc: { - start: { column: 20, line: 2 }, - end: { column: 23, line: 2 }, - }, - }, - static: false, - typeAnnotation: TSTypeAnnotation { - type: "TSTypeAnnotation", - typeAnnotation: TSNumberKeyword { - type: "TSNumberKeyword", - - range: [46, 52], - loc: { - start: { column: 25, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, - - range: [44, 52], - loc: { - start: { column: 23, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, - value: Literal { - type: "Literal", - raw: "1", - value: 1, - - range: [55, 56], - loc: { - start: { column: 34, line: 2 }, - end: { column: 35, line: 2 }, - }, - }, - - range: [23, 57], - loc: { - start: { column: 2, line: 2 }, - end: { column: 36, line: 2 }, - }, - }, - ], - - range: [19, 59], - loc: { - start: { column: 19, line: 1 }, - end: { column: 1, line: 3 }, - }, - }, - id: Identifier { - type: "Identifier", - name: "Foo", - - range: [15, 18], - loc: { - start: { column: 15, line: 1 }, - end: { column: 18, line: 1 }, - }, - }, - superClass: null, - - range: [0, 59], - loc: { - start: { column: 0, line: 1 }, - end: { column: 1, line: 3 }, - }, - }, - ], - sourceType: "script", - - range: [0, 60], - loc: { - start: { column: 0, line: 1 }, - end: { column: 0, line: 4 }, - }, -} -`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/1-TSESTree-AST.shot deleted file mode 100644 index 131625db754..00000000000 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/1-TSESTree-AST.shot +++ /dev/null @@ -1,101 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value TSESTree - AST 1`] = ` -Program { - type: "Program", - body: Array [ - ClassDeclaration { - type: "ClassDeclaration", - abstract: true, - body: ClassBody { - type: "ClassBody", - body: Array [ - TSAbstractAccessorProperty { - type: "TSAbstractAccessorProperty", - computed: false, - declare: false, - decorators: Array [], - definite: false, - key: Identifier { - type: "Identifier", - decorators: Array [], - name: "foo", - optional: false, - - range: [41, 44], - loc: { - start: { column: 20, line: 2 }, - end: { column: 23, line: 2 }, - }, - }, - optional: false, - override: false, - readonly: false, - static: false, - typeAnnotation: TSTypeAnnotation { - type: "TSTypeAnnotation", - typeAnnotation: TSNumberKeyword { - type: "TSNumberKeyword", - - range: [46, 52], - loc: { - start: { column: 25, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, - - range: [44, 52], - loc: { - start: { column: 23, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, - value: null, - - range: [23, 57], - loc: { - start: { column: 2, line: 2 }, - end: { column: 36, line: 2 }, - }, - }, - ], - - range: [19, 59], - loc: { - start: { column: 19, line: 1 }, - end: { column: 1, line: 3 }, - }, - }, - declare: false, - decorators: Array [], - id: Identifier { - type: "Identifier", - decorators: Array [], - name: "Foo", - optional: false, - - range: [15, 18], - loc: { - start: { column: 15, line: 1 }, - end: { column: 18, line: 1 }, - }, - }, - implements: Array [], - superClass: null, - - range: [0, 59], - loc: { - start: { column: 0, line: 1 }, - end: { column: 1, line: 3 }, - }, - }, - ], - sourceType: "script", - - range: [0, 60], - loc: { - start: { column: 0, line: 1 }, - end: { column: 0, line: 4 }, - }, -} -`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-Babel-Tokens.shot deleted file mode 100644 index 1d49b0c7ad1..00000000000 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-Babel-Tokens.shot +++ /dev/null @@ -1,136 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value Babel - Tokens 1`] = ` -Array [ - 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: "abstract", - - range: [23, 31], - loc: { - start: { column: 2, line: 2 }, - end: { column: 10, line: 2 }, - }, - }, - Identifier { - type: "Identifier", - value: "accessor", - - range: [32, 40], - loc: { - start: { column: 11, line: 2 }, - end: { column: 19, line: 2 }, - }, - }, - Identifier { - type: "Identifier", - value: "foo", - - range: [41, 44], - loc: { - start: { column: 20, 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 }, - }, - }, - Identifier { - type: "Identifier", - value: "number", - - range: [46, 52], - loc: { - start: { column: 25, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "=", - - range: [53, 54], - loc: { - start: { column: 32, line: 2 }, - end: { column: 33, line: 2 }, - }, - }, - Numeric { - type: "Numeric", - value: "1", - - range: [55, 56], - loc: { - start: { column: 34, line: 2 }, - end: { column: 35, line: 2 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ";", - - range: [56, 57], - loc: { - start: { column: 35, line: 2 }, - end: { column: 36, line: 2 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "}", - - range: [58, 59], - loc: { - start: { column: 0, line: 3 }, - end: { column: 1, line: 3 }, - }, - }, -] -`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-TSESTree-Tokens.shot deleted file mode 100644 index b993bfecdea..00000000000 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-TSESTree-Tokens.shot +++ /dev/null @@ -1,136 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value TSESTree - Tokens 1`] = ` -Array [ - 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: "abstract", - - range: [23, 31], - loc: { - start: { column: 2, line: 2 }, - end: { column: 10, line: 2 }, - }, - }, - Identifier { - type: "Identifier", - value: "accessor", - - range: [32, 40], - loc: { - start: { column: 11, line: 2 }, - end: { column: 19, line: 2 }, - }, - }, - Identifier { - type: "Identifier", - value: "foo", - - range: [41, 44], - loc: { - start: { column: 20, 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 }, - }, - }, - Identifier { - type: "Identifier", - value: "number", - - range: [46, 52], - loc: { - start: { column: 25, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "=", - - range: [53, 54], - loc: { - start: { column: 32, line: 2 }, - end: { column: 33, line: 2 }, - }, - }, - Numeric { - type: "Numeric", - value: "1", - - range: [55, 56], - loc: { - start: { column: 34, line: 2 }, - end: { column: 35, line: 2 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ";", - - range: [56, 57], - loc: { - start: { column: 35, line: 2 }, - end: { column: 36, line: 2 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "}", - - range: [58, 59], - loc: { - start: { column: 0, line: 3 }, - end: { column: 1, line: 3 }, - }, - }, -] -`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/3-Babel-AST.shot deleted file mode 100644 index 147bdd6cb25..00000000000 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/3-Babel-AST.shot +++ /dev/null @@ -1,99 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value Babel - AST 1`] = ` -Program { - type: "Program", - body: Array [ - ClassDeclaration { - type: "ClassDeclaration", - abstract: true, - body: ClassBody { - type: "ClassBody", - body: Array [ - ClassAccessorProperty { - type: "ClassAccessorProperty", - abstract: true, - computed: false, - key: Identifier { - type: "Identifier", - name: "foo", - - range: [41, 44], - loc: { - start: { column: 20, line: 2 }, - end: { column: 23, line: 2 }, - }, - }, - static: false, - typeAnnotation: TSTypeAnnotation { - type: "TSTypeAnnotation", - typeAnnotation: TSNumberKeyword { - type: "TSNumberKeyword", - - range: [46, 52], - loc: { - start: { column: 25, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, - - range: [44, 52], - loc: { - start: { column: 23, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, - value: Literal { - type: "Literal", - raw: "1", - value: 1, - - range: [55, 56], - loc: { - start: { column: 34, line: 2 }, - end: { column: 35, line: 2 }, - }, - }, - - range: [23, 57], - loc: { - start: { column: 2, line: 2 }, - end: { column: 36, line: 2 }, - }, - }, - ], - - range: [19, 59], - loc: { - start: { column: 19, line: 1 }, - end: { column: 1, line: 3 }, - }, - }, - id: Identifier { - type: "Identifier", - name: "Foo", - - range: [15, 18], - loc: { - start: { column: 15, line: 1 }, - end: { column: 18, line: 1 }, - }, - }, - superClass: null, - - range: [0, 59], - loc: { - start: { column: 0, line: 1 }, - end: { column: 1, line: 3 }, - }, - }, - ], - sourceType: "script", - - range: [0, 60], - loc: { - start: { column: 0, line: 1 }, - end: { column: 0, line: 4 }, - }, -} -`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/4-Babel-Tokens.shot deleted file mode 100644 index 1d49b0c7ad1..00000000000 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/4-Babel-Tokens.shot +++ /dev/null @@ -1,136 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value Babel - Tokens 1`] = ` -Array [ - 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: "abstract", - - range: [23, 31], - loc: { - start: { column: 2, line: 2 }, - end: { column: 10, line: 2 }, - }, - }, - Identifier { - type: "Identifier", - value: "accessor", - - range: [32, 40], - loc: { - start: { column: 11, line: 2 }, - end: { column: 19, line: 2 }, - }, - }, - Identifier { - type: "Identifier", - value: "foo", - - range: [41, 44], - loc: { - start: { column: 20, 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 }, - }, - }, - Identifier { - type: "Identifier", - value: "number", - - range: [46, 52], - loc: { - start: { column: 25, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "=", - - range: [53, 54], - loc: { - start: { column: 32, line: 2 }, - end: { column: 33, line: 2 }, - }, - }, - Numeric { - type: "Numeric", - value: "1", - - range: [55, 56], - loc: { - start: { column: 34, line: 2 }, - end: { column: 35, line: 2 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ";", - - range: [56, 57], - loc: { - start: { column: 35, line: 2 }, - end: { column: 36, line: 2 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "}", - - range: [58, 59], - loc: { - start: { column: 0, line: 3 }, - end: { column: 1, line: 3 }, - }, - }, -] -`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/5-AST-Alignment-AST.shot deleted file mode 100644 index 957a65859f2..00000000000 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/5-AST-Alignment-AST.shot +++ /dev/null @@ -1,119 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value AST Alignment - AST 1`] = ` -"Snapshot Diff: -- TSESTree -+ Babel - - Program { - type: 'Program', - body: Array [ - ClassDeclaration { - type: 'ClassDeclaration', - abstract: true, - body: ClassBody { - type: 'ClassBody', - body: Array [ -- TSAbstractAccessorProperty { -- type: 'TSAbstractAccessorProperty', -+ ClassAccessorProperty { -+ type: 'ClassAccessorProperty', -+ abstract: true, - computed: false, -- declare: false, -- decorators: Array [], -- definite: false, - key: Identifier { - type: 'Identifier', -- decorators: Array [], - name: 'foo', -- optional: false, - - range: [41, 44], - loc: { - start: { column: 20, line: 2 }, - end: { column: 23, line: 2 }, - }, - }, -- optional: false, -- override: false, -- readonly: false, - static: false, - typeAnnotation: TSTypeAnnotation { - type: 'TSTypeAnnotation', - typeAnnotation: TSNumberKeyword { - type: 'TSNumberKeyword', - - range: [46, 52], - loc: { - start: { column: 25, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, - - range: [44, 52], - loc: { - start: { column: 23, line: 2 }, - end: { column: 31, line: 2 }, -+ }, -+ }, -+ value: Literal { -+ type: 'Literal', -+ raw: '1', -+ value: 1, -+ -+ range: [55, 56], -+ loc: { -+ start: { column: 34, line: 2 }, -+ end: { column: 35, line: 2 }, - }, - }, -- value: null, - - range: [23, 57], - loc: { - start: { column: 2, line: 2 }, - end: { column: 36, line: 2 }, - }, - }, - ], - - range: [19, 59], - loc: { - start: { column: 19, line: 1 }, - end: { column: 1, line: 3 }, - }, - }, -- declare: false, -- decorators: Array [], - id: Identifier { - type: 'Identifier', -- decorators: Array [], - name: 'Foo', -- optional: false, - - range: [15, 18], - loc: { - start: { column: 15, line: 1 }, - end: { column: 18, line: 1 }, - }, - }, -- implements: Array [], - superClass: null, - - range: [0, 59], - loc: { - start: { column: 0, line: 1 }, - end: { column: 1, line: 3 }, - }, - }, - ], - sourceType: 'script', - - range: [0, 60], - loc: { - start: { column: 0, line: 1 }, - end: { column: 0, line: 4 }, - }, - }" -`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/6-AST-Alignment-Tokens.shot deleted file mode 100644 index fd832b249e4..00000000000 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/6-AST-Alignment-Tokens.shot +++ /dev/null @@ -1,6 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value AST Alignment - Token 1`] = ` -"Snapshot Diff: -Compared values have no visual difference." -`; From f95b84c5f77d115106147d3723cf890b8ea52a2b Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Mon, 13 Mar 2023 14:45:27 +0800 Subject: [PATCH 6/8] Update packages/typescript-estree/src/convert.ts Co-authored-by: Josh Goldberg --- packages/typescript-estree/src/convert.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index bf70f21526f..748c09677a8 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -1143,7 +1143,6 @@ export class Converter { case SyntaxKind.PropertyDeclaration: { const isAbstract = hasModifier(SyntaxKind.AbstractKeyword, node); - const isAccessor = hasModifier(SyntaxKind.AccessorKeyword, node); if (isAbstract && node.initializer) { this.#throwError( @@ -1152,6 +1151,7 @@ export class Converter { ); } + const isAccessor = hasModifier(SyntaxKind.AccessorKeyword, node); // eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- TODO - add ignore IIFE option const type = (() => { if (isAccessor) { From 3a4b73f35a539acc8fbac6fbcf0b75b30fa2633c Mon Sep 17 00:00:00 2001 From: fisker Date: Tue, 14 Mar 2023 09:47:14 +0800 Subject: [PATCH 7/8] Fix test --- .../tests/rules/naming-convention/cases/property.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/tests/rules/naming-convention/cases/property.test.ts b/packages/eslint-plugin/tests/rules/naming-convention/cases/property.test.ts index 6d8fdf42608..accdfd8d08c 100644 --- a/packages/eslint-plugin/tests/rules/naming-convention/cases/property.test.ts +++ b/packages/eslint-plugin/tests/rules/naming-convention/cases/property.test.ts @@ -8,7 +8,7 @@ createTestCases([ 'class Ignored { private readonly % = 1 }', 'class Ignored { private static % }', 'class Ignored { private static readonly % = 1 }', - 'class Ignored { abstract % = 1 }', + 'class Ignored { abstract % }', 'class Ignored { declare % }', 'class Ignored { #% }', 'class Ignored { static #% }', From 3d509cfd84fa1a6e98a5667c48887fd39dd00ade Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Thu, 16 Mar 2023 10:27:49 +1030 Subject: [PATCH 8/8] fix bad merge --- packages/ast-spec/tests/fixtures-with-differences-errors.shot | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/ast-spec/tests/fixtures-with-differences-errors.shot b/packages/ast-spec/tests/fixtures-with-differences-errors.shot index 56039c13899..9b90f826002 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-errors.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-errors.shot @@ -22,9 +22,6 @@ exports[`AST Fixtures List fixtures with Error differences 1`] = ` "declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/fixture.ts", "declaration/VariableDeclaration/fixtures/_error_/decorator/fixture.ts", "element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/fixture.ts", - "legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-static-constructor/fixture.ts", - "legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/fixture.ts", - "legacy-fixtures/basics/fixtures/_error_/abstract-interface/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/await-without-async-function/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/class-private-identifier-field-with-accessibility-error/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/class-with-constructor-and-type-parameters/fixture.ts",