diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/fixture.ts b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/fixture.ts similarity index 100% rename from packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/fixture.ts rename to packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/fixture.ts diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..fd0e954ee51 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ abstract-class-with-abstract-constructor TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | export abstract class AbstractSocket { +> 4 | abstract constructor(); + | ^^^^^^^^ 'abstract' modifier can only appear on a class, method, or property declaration. + 5 | } + 6 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..365be7ab31e --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ abstract-class-with-abstract-constructor Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..c2e76b6b75d --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ abstract-class-with-abstract-constructor Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-static-constructor/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-static-constructor/snapshots/1-TSESTree-Error.shot index bb695d9a0b1..500f8130606 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-static-constructor/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-static-constructor/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-abstract-static-constructor TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures basics _error_ abstract-class-with-abstract-static-constructor TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | export abstract class AbstractSocket { +> 4 | abstract static constructor(); + | ^^^^^^^^ 'abstract' modifier can only appear on a class, method, or property declaration. + 5 | } + 6 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-static-constructor/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-static-constructor/snapshots/3-Alignment-Error.shot index 37fb30a105a..fc418fa8c4b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-static-constructor/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-static-constructor/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-abstract-static-constructor Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures basics _error_ abstract-class-with-abstract-static-constructor Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-interface/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-interface/snapshots/1-TSESTree-Error.shot index 43e910b9175..c9a5983adf1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-interface/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-interface/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures basics _error_ abstract-interface TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures basics _error_ abstract-interface TSESTree - Error 1`] = ` +"TSError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | export abstract interface I { + | ^^^^^^^^ 'abstract' modifier can only appear on a class, method, or property declaration. + 4 | }" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-interface/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-interface/snapshots/3-Alignment-Error.shot index 15c7f73220a..67a613a53ca 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-interface/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-interface/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures basics _error_ abstract-interface Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures basics _error_ abstract-interface Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-export-parameter-properties/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-export-parameter-properties/snapshots/1-TSESTree-Error.shot index c54977ea56f..e685ce389b5 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-export-parameter-properties/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-export-parameter-properties/snapshots/1-TSESTree-Error.shot @@ -5,7 +5,7 @@ exports[`AST Fixtures legacy-fixtures basics _error_ class-with-export-parameter 2 | 3 | class Foo { > 4 | constructor(export a: string) { - | ^^^^^^ A parameter cannot have an export modifier. + | ^^^^^^ 'export' modifier cannot appear on a parameter. 5 | 6 | } 7 | }" diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/snapshots/1-TSESTree-Error.shot index 4a14ecee200..54b7990c831 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures basics _error_ class-with-static-parameter-properties TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures basics _error_ class-with-static-parameter-properties TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | class Foo { +> 4 | constructor(static a: string) { + | ^^^^^^ 'static' modifier cannot appear on a parameter. + 5 | + 6 | } + 7 | }" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/snapshots/3-Alignment-Error.shot index 588fc5dd036..d5010c61e43 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures basics _error_ class-with-static-parameter-properties Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures basics _error_ class-with-static-parameter-properties Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/snapshots/1-TSESTree-Error.shot index fda3178b272..db761981b7e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures basics _error_ interface-with-construct-signature-with-parameter-accessibility TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures basics _error_ interface-with-construct-signature-with-parameter-accessibility TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Test { +> 4 | new (public x, private y); + | ^^^^^^ A parameter property is only allowed in a constructor implementation. + 5 | } + 6 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/snapshots/3-Alignment-Error.shot index d39bd1e45e7..f863933783d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures basics _error_ interface-with-construct-signature-with-parameter-accessibility Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures basics _error_ interface-with-construct-signature-with-parameter-accessibility Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/1-TSESTree-AST.shot deleted file mode 100644 index a087c02bb9b..00000000000 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/1-TSESTree-AST.shot +++ /dev/null @@ -1,109 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-constructor TSESTree - AST 1`] = ` -Program { - type: "Program", - body: [ - ExportNamedDeclaration { - type: "ExportNamedDeclaration", - assertions: [], - declaration: ClassDeclaration { - type: "ClassDeclaration", - abstract: true, - body: ClassBody { - type: "ClassBody", - body: [ - TSAbstractMethodDefinition { - type: "TSAbstractMethodDefinition", - computed: false, - decorators: [], - key: Identifier { - type: "Identifier", - decorators: [], - name: "constructor", - optional: false, - - range: [123, 134], - loc: { - start: { column: 11, line: 4 }, - end: { column: 22, line: 4 }, - }, - }, - kind: "constructor", - optional: false, - override: false, - static: false, - value: TSEmptyBodyFunctionExpression { - type: "TSEmptyBodyFunctionExpression", - async: false, - body: null, - declare: false, - expression: false, - generator: false, - id: null, - params: [], - - range: [134, 137], - loc: { - start: { column: 22, line: 4 }, - end: { column: 25, line: 4 }, - }, - }, - - range: [114, 137], - loc: { - start: { column: 2, line: 4 }, - end: { column: 25, line: 4 }, - }, - }, - ], - - range: [110, 139], - loc: { - start: { column: 37, line: 3 }, - end: { column: 1, line: 5 }, - }, - }, - declare: false, - decorators: [], - id: Identifier { - type: "Identifier", - decorators: [], - name: "AbstractSocket", - optional: false, - - range: [95, 109], - loc: { - start: { column: 22, line: 3 }, - end: { column: 36, line: 3 }, - }, - }, - implements: [], - superClass: null, - - range: [80, 139], - loc: { - start: { column: 7, line: 3 }, - end: { column: 1, line: 5 }, - }, - }, - exportKind: "value", - source: null, - specifiers: [], - - range: [73, 139], - loc: { - start: { column: 0, line: 3 }, - end: { column: 1, line: 5 }, - }, - }, - ], - sourceType: "module", - - range: [73, 140], - loc: { - start: { column: 0, line: 3 }, - end: { column: 0, line: 6 }, - }, -} -`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/2-TSESTree-Tokens.shot deleted file mode 100644 index efedccbc060..00000000000 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/2-TSESTree-Tokens.shot +++ /dev/null @@ -1,116 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-constructor TSESTree - Tokens 1`] = ` -[ - Keyword { - type: "Keyword", - value: "export", - - range: [73, 79], - loc: { - start: { column: 0, line: 3 }, - end: { column: 6, line: 3 }, - }, - }, - Identifier { - type: "Identifier", - value: "abstract", - - range: [80, 88], - loc: { - start: { column: 7, line: 3 }, - end: { column: 15, line: 3 }, - }, - }, - Keyword { - type: "Keyword", - value: "class", - - range: [89, 94], - loc: { - start: { column: 16, line: 3 }, - end: { column: 21, line: 3 }, - }, - }, - Identifier { - type: "Identifier", - value: "AbstractSocket", - - range: [95, 109], - loc: { - start: { column: 22, line: 3 }, - end: { column: 36, line: 3 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "{", - - range: [110, 111], - loc: { - start: { column: 37, line: 3 }, - end: { column: 38, line: 3 }, - }, - }, - Identifier { - type: "Identifier", - value: "abstract", - - range: [114, 122], - loc: { - start: { column: 2, line: 4 }, - end: { column: 10, line: 4 }, - }, - }, - Identifier { - type: "Identifier", - value: "constructor", - - range: [123, 134], - loc: { - start: { column: 11, line: 4 }, - end: { column: 22, line: 4 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "(", - - range: [134, 135], - loc: { - start: { column: 22, line: 4 }, - end: { column: 23, line: 4 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ")", - - range: [135, 136], - loc: { - start: { column: 23, line: 4 }, - end: { column: 24, line: 4 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ";", - - range: [136, 137], - loc: { - start: { column: 24, line: 4 }, - end: { column: 25, line: 4 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "}", - - range: [138, 139], - loc: { - start: { column: 0, line: 5 }, - end: { column: 1, line: 5 }, - }, - }, -] -`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/3-Babel-AST.shot deleted file mode 100644 index a53c2df0e58..00000000000 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/3-Babel-AST.shot +++ /dev/null @@ -1,98 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-constructor Babel - AST 1`] = ` -Program { - type: "Program", - body: [ - ExportNamedDeclaration { - type: "ExportNamedDeclaration", - assertions: [], - declaration: ClassDeclaration { - type: "ClassDeclaration", - abstract: true, - body: ClassBody { - type: "ClassBody", - body: [ - MethodDefinition { - type: "MethodDefinition", - abstract: true, - computed: false, - key: Identifier { - type: "Identifier", - name: "constructor", - - range: [123, 134], - loc: { - start: { column: 11, line: 4 }, - end: { column: 22, line: 4 }, - }, - }, - kind: "constructor", - static: false, - value: FunctionExpression { - type: "FunctionExpression", - async: false, - expression: false, - generator: false, - id: null, - params: [], - - range: [134, 137], - loc: { - start: { column: 22, line: 4 }, - end: { column: 25, line: 4 }, - }, - }, - - range: [114, 137], - loc: { - start: { column: 2, line: 4 }, - end: { column: 25, line: 4 }, - }, - }, - ], - - range: [110, 139], - loc: { - start: { column: 37, line: 3 }, - end: { column: 1, line: 5 }, - }, - }, - id: Identifier { - type: "Identifier", - name: "AbstractSocket", - - range: [95, 109], - loc: { - start: { column: 22, line: 3 }, - end: { column: 36, line: 3 }, - }, - }, - superClass: null, - - range: [80, 139], - loc: { - start: { column: 7, line: 3 }, - end: { column: 1, line: 5 }, - }, - }, - exportKind: "value", - source: null, - specifiers: [], - - range: [73, 139], - loc: { - start: { column: 0, line: 3 }, - end: { column: 1, line: 5 }, - }, - }, - ], - sourceType: "module", - - range: [73, 140], - loc: { - start: { column: 0, line: 3 }, - end: { column: 0, line: 6 }, - }, -} -`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/4-Babel-Tokens.shot deleted file mode 100644 index a495e97a9ca..00000000000 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/4-Babel-Tokens.shot +++ /dev/null @@ -1,116 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-constructor Babel - Tokens 1`] = ` -[ - Keyword { - type: "Keyword", - value: "export", - - range: [73, 79], - loc: { - start: { column: 0, line: 3 }, - end: { column: 6, line: 3 }, - }, - }, - Identifier { - type: "Identifier", - value: "abstract", - - range: [80, 88], - loc: { - start: { column: 7, line: 3 }, - end: { column: 15, line: 3 }, - }, - }, - Keyword { - type: "Keyword", - value: "class", - - range: [89, 94], - loc: { - start: { column: 16, line: 3 }, - end: { column: 21, line: 3 }, - }, - }, - Identifier { - type: "Identifier", - value: "AbstractSocket", - - range: [95, 109], - loc: { - start: { column: 22, line: 3 }, - end: { column: 36, line: 3 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "{", - - range: [110, 111], - loc: { - start: { column: 37, line: 3 }, - end: { column: 38, line: 3 }, - }, - }, - Identifier { - type: "Identifier", - value: "abstract", - - range: [114, 122], - loc: { - start: { column: 2, line: 4 }, - end: { column: 10, line: 4 }, - }, - }, - Identifier { - type: "Identifier", - value: "constructor", - - range: [123, 134], - loc: { - start: { column: 11, line: 4 }, - end: { column: 22, line: 4 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "(", - - range: [134, 135], - loc: { - start: { column: 22, line: 4 }, - end: { column: 23, line: 4 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ")", - - range: [135, 136], - loc: { - start: { column: 23, line: 4 }, - end: { column: 24, line: 4 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ";", - - range: [136, 137], - loc: { - start: { column: 24, line: 4 }, - end: { column: 25, line: 4 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "}", - - range: [138, 139], - loc: { - start: { column: 0, line: 5 }, - end: { column: 1, line: 5 }, - }, - }, -] -`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/5-AST-Alignment-AST.shot deleted file mode 100644 index fda50436316..00000000000 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/5-AST-Alignment-AST.shot +++ /dev/null @@ -1,118 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-constructor AST Alignment - AST 1`] = ` -"Snapshot Diff: -- TSESTree -+ Babel - - Program { - type: 'Program', - body: Array [ - ExportNamedDeclaration { - type: 'ExportNamedDeclaration', - assertions: Array [], - declaration: ClassDeclaration { - type: 'ClassDeclaration', - abstract: true, - body: ClassBody { - type: 'ClassBody', - body: Array [ -- TSAbstractMethodDefinition { -- type: 'TSAbstractMethodDefinition', -+ MethodDefinition { -+ type: 'MethodDefinition', -+ abstract: true, - computed: false, -- decorators: Array [], - key: Identifier { - type: 'Identifier', -- decorators: Array [], - name: 'constructor', -- optional: false, - - range: [123, 134], - loc: { - start: { column: 11, line: 4 }, - end: { column: 22, line: 4 }, - }, - }, - kind: 'constructor', -- optional: false, -- override: false, - static: false, -- value: TSEmptyBodyFunctionExpression { -- type: 'TSEmptyBodyFunctionExpression', -+ value: FunctionExpression { -+ type: 'FunctionExpression', - async: false, -- body: null, -- declare: false, - expression: false, - generator: false, - id: null, - params: Array [], - - range: [134, 137], - loc: { - start: { column: 22, line: 4 }, - end: { column: 25, line: 4 }, - }, - }, - - range: [114, 137], - loc: { - start: { column: 2, line: 4 }, - end: { column: 25, line: 4 }, - }, - }, - ], - - range: [110, 139], - loc: { - start: { column: 37, line: 3 }, - end: { column: 1, line: 5 }, - }, - }, -- declare: false, -- decorators: Array [], - id: Identifier { - type: 'Identifier', -- decorators: Array [], - name: 'AbstractSocket', -- optional: false, - - range: [95, 109], - loc: { - start: { column: 22, line: 3 }, - end: { column: 36, line: 3 }, - }, - }, -- implements: Array [], - superClass: null, - - range: [80, 139], - loc: { - start: { column: 7, line: 3 }, - end: { column: 1, line: 5 }, - }, - }, - exportKind: 'value', - source: null, - specifiers: Array [], - - range: [73, 139], - loc: { - start: { column: 0, line: 3 }, - end: { column: 1, line: 5 }, - }, - }, - ], - sourceType: 'module', - - range: [73, 140], - loc: { - start: { column: 0, line: 3 }, - end: { column: 0, line: 6 }, - }, - }" -`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/6-AST-Alignment-Tokens.shot deleted file mode 100644 index b5d33dfde11..00000000000 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/6-AST-Alignment-Tokens.shot +++ /dev/null @@ -1,6 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-constructor AST Alignment - Token 1`] = ` -"Snapshot Diff: -Compared values have no visual difference." -`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/snapshots/1-TSESTree-Error.shot index 264bd320faa..b90437fa5b2 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ enum-with-keywords TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ enum-with-keywords TSESTree - Error 1`] = ` +"TSError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | export private public protected static readonly abstract async enum X {} + | ^^^^^^^ 'private' modifier cannot appear on a module or namespace element." +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/snapshots/3-Alignment-Error.shot index ada94f82c3a..fd6c43a4704 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ enum-with-keywords Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ enum-with-keywords Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-export/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-export/snapshots/1-TSESTree-Error.shot index 699355afeef..d601da71753 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-export/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-export/snapshots/1-TSESTree-Error.shot @@ -5,7 +5,7 @@ exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-sign 2 | 3 | interface Foo { > 4 | export [baz: string]: string; - | ^^^^^^ An index signature cannot have an export modifier. + | ^^^^^^ 'export' modifier cannot appear on an index signature 5 | } 6 | 7 |" diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/snapshots/1-TSESTree-Error.shot index 13a96652b2b..3940bf8f5ae 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-private TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-private TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | private [baz: string]: string; + | ^^^^^^^ 'private' modifier cannot appear on an index signature + 5 | } + 6 | + 7 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/snapshots/3-Alignment-Error.shot index 70ae64a4a82..1bf7e6a8b1e 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-private Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-private Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/snapshots/1-TSESTree-Error.shot index b6d263475ee..7147acc9576 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-protected TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-protected TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | protected [baz: string]: string; + | ^^^^^^^^^ 'protected' modifier cannot appear on an index signature + 5 | } + 6 | + 7 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/snapshots/3-Alignment-Error.shot index 49a27a188b9..4c798313f87 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-protected Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-protected Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/snapshots/1-TSESTree-Error.shot index 0ca583aff84..d57bbb6da4a 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-public TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-public TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | public [baz: string]: string; + | ^^^^^^ 'public' modifier cannot appear on an index signature + 5 | } + 6 | + 7 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/snapshots/3-Alignment-Error.shot index 959f932de08..50357e981e2 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-public Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-public Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/snapshots/1-TSESTree-Error.shot index 1d5a7a35239..e3b090eb8f0 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-static TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-static TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | static [baz: string]: string; + | ^^^^^^ 'static' modifier cannot appear on an index signature + 5 | } + 6 | + 7 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/snapshots/3-Alignment-Error.shot index 1730fddc173..5267ec675b0 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-static Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-static Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-export/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-export/snapshots/1-TSESTree-Error.shot index 36f8fd7fddd..02668d51abb 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-export/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-export/snapshots/1-TSESTree-Error.shot @@ -5,7 +5,7 @@ exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-exp 2 | 3 | interface Foo { > 4 | export g(bar: string): void; - | ^^^^^^ A method signature cannot have an export modifier. + | ^^^^^^ 'export' modifier cannot appear on a type member 5 | } 6 | 7 |" diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/snapshots/1-TSESTree-Error.shot index 131a13aa7ee..b3cd691f7f0 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-private TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-private TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | private g(bar: string): void; + | ^^^^^^^ 'private' modifier cannot appear on a type member + 5 | } + 6 | + 7 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/snapshots/3-Alignment-Error.shot index 2afbbf45ed3..910e9cc77af 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-private Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-private Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/snapshots/1-TSESTree-Error.shot index 2976cbb6ecf..33f41f8ba61 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-protected TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-protected TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | protected g(bar: string): void; + | ^^^^^^^^^ 'protected' modifier cannot appear on a type member + 5 | } + 6 | + 7 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/snapshots/3-Alignment-Error.shot index 0af7e82ad38..c022672d659 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-protected Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-protected Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/snapshots/1-TSESTree-Error.shot index 32cb1ca974d..bf76c446e28 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-public TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-public TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | public g(bar: string): void; + | ^^^^^^ 'public' modifier cannot appear on a type member + 5 | } + 6 | + 7 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/snapshots/3-Alignment-Error.shot index 0a09195bd84..61705bea29d 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-public Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-public Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/snapshots/1-TSESTree-Error.shot index 34d6269d02d..7d3f94f6639 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-readonly TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-readonly TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | readonly g(bar: string): void; + | ^^^^^^^^ 'readonly' modifier can only appear on a property declaration or index signature. + 5 | } + 6 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/snapshots/3-Alignment-Error.shot index 062e4baddd0..9f0aaf74ac0 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-readonly Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-readonly Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/snapshots/1-TSESTree-Error.shot index 01ec4dc383c..55732d2bf4a 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-static TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-static TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | static g(bar: string): void; + | ^^^^^^ 'static' modifier cannot appear on a type member + 5 | } + 6 | + 7 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/snapshots/3-Alignment-Error.shot index 0cb366cff16..a4a703dca99 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-static Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-static Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-export/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-export/snapshots/1-TSESTree-Error.shot index f21b92669e1..8cf3e746b6d 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-export/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-export/snapshots/1-TSESTree-Error.shot @@ -5,7 +5,7 @@ exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-e 2 | 3 | interface Foo { > 4 | export a: string; - | ^^^^^^ A property signature cannot have an export modifier. + | ^^^^^^ 'export' modifier cannot appear on a type member 5 | } 6 | 7 |" diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/snapshots/1-TSESTree-Error.shot index c9e45d49f90..74e32d60e43 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-private TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-private TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | private b: string; + | ^^^^^^^ 'private' modifier cannot appear on a type member + 5 | } + 6 | + 7 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/snapshots/3-Alignment-Error.shot index 3a57033e136..a5c250cd314 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-private Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-private Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/snapshots/1-TSESTree-Error.shot index 945a89aeb8e..4ae03bf3890 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-protected TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-protected TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | protected a: string; + | ^^^^^^^^^ 'protected' modifier cannot appear on a type member + 5 | } + 6 | + 7 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/snapshots/3-Alignment-Error.shot index 65e263e1264..11ddafba81b 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-protected Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-protected Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/snapshots/1-TSESTree-Error.shot index 0beb40de987..43f06b1fa7c 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-public TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-public TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | public a: string; + | ^^^^^^ 'public' modifier cannot appear on a type member + 5 | } + 6 | + 7 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/snapshots/3-Alignment-Error.shot index 6fe49dd919f..b4deaff7a34 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-public Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-public Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/snapshots/1-TSESTree-Error.shot index 4e3c66cecea..eb8d16d999f 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-static TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-static TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | static a: string; + | ^^^^^^ 'static' modifier cannot appear on a type member + 5 | } + 6 | + 7 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/snapshots/3-Alignment-Error.shot index 6e4940eb9ba..bdd3d867196 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-static Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-static 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 3466bc041b9..d416f5e2d93 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-ast.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-ast.shot @@ -135,7 +135,6 @@ Set { "legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-static-member/fixture.ts", "legacy-fixtures/babylon-convergence/fixtures/type-parameter-whitespace-loc/fixture.ts", "legacy-fixtures/babylon-convergence/fixtures/type-parameters/fixture.ts", - "legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/fixture.ts", "legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/fixture.ts", "legacy-fixtures/basics/fixtures/abstract-class-with-abstract-properties/fixture.ts", "legacy-fixtures/basics/fixtures/abstract-class-with-abstract-readonly-property/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 59c2e591ad7..20b5b5200d0 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-errors.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-errors.shot @@ -22,13 +22,10 @@ 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", - "legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/class-with-two-methods-computed-constructor/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/const-assertions/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/fixture.ts", @@ -36,7 +33,6 @@ exports[`AST Fixtures List fixtures with Error differences 1`] = ` "legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/export-with-import-assertions/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/import-type-error/fixture.ts", - "legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/new-target-in-arrow-function-body/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/var-with-definite-assignment/fixture.ts", "legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-enum-declaration/fixture.ts", @@ -52,23 +48,9 @@ exports[`AST Fixtures List fixtures with Error differences 1`] = ` "legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method-signature/fixture.ts", "legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method/fixture.ts", "legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/fixture.ts", "legacy-fixtures/errorRecovery/fixtures/_error_/index-signature-parameters/fixture.ts", "legacy-fixtures/errorRecovery/fixtures/_error_/interface-empty-extends/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/fixture.ts", "legacy-fixtures/errorRecovery/fixtures/_error_/interface-multiple-extends/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/fixture.ts", "legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-optional-index-signature/fixture.ts", "legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-array-pattern-decorator/fixture.ts", "legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-rest-element-decorator/fixture.ts", @@ -76,6 +58,7 @@ exports[`AST Fixtures List fixtures with Error differences 1`] = ` "TSESTree errored but Babel didn't": Set { "declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/fixture.ts", "declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/fixture.ts", + "legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/fixture.ts", "legacy-fixtures/expressions/fixtures/_error_/instantiation-expression/fixture.ts", }, } diff --git a/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts b/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts index 04a6fa55842..92ab931e121 100644 --- a/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts @@ -1469,7 +1469,6 @@ class Test { filename: 'test.ts', code: noFormat` class Test { - @public public /*public*/constructor(private foo: string) {} } `, @@ -1487,7 +1486,6 @@ class Test { ], output: ` class Test { - @public /*public*/constructor(private foo: string) {} } `, @@ -1577,7 +1575,7 @@ class Test { filename: 'test.ts', code: noFormat` class Test { - contructor(public/* Hi there */ readonly foo); + constructor(public/* Hi there */ readonly foo) {} } `, options: [ @@ -1590,12 +1588,12 @@ class Test { { messageId: 'unwantedPublicAccessibility', line: 3, - column: 14, + column: 15, }, ], output: ` class Test { - contructor(/* Hi there */ readonly foo); + constructor(/* Hi there */ readonly foo) {} } `, }, @@ -1603,7 +1601,7 @@ class Test { filename: 'test.ts', code: ` class Test { - contructor(public readonly foo: string); + constructor(public readonly foo: string) {} } `, options: [ @@ -1615,12 +1613,12 @@ class Test { { messageId: 'unwantedPublicAccessibility', line: 3, - column: 14, + column: 15, }, ], output: ` class Test { - contructor(readonly foo: string); + constructor(readonly foo: string) {} } `, }, diff --git a/packages/eslint-plugin/tests/rules/member-ordering.test.ts b/packages/eslint-plugin/tests/rules/member-ordering.test.ts index 89f499d697b..6eba24b000c 100644 --- a/packages/eslint-plugin/tests/rules/member-ordering.test.ts +++ b/packages/eslint-plugin/tests/rules/member-ordering.test.ts @@ -4299,7 +4299,7 @@ class Foo { C: number; [A: string]: number; public static D(): {}; - private static [B: string]: number; + static [B: string]: number; } `, options: [ diff --git a/packages/eslint-plugin/tests/rules/method-signature-style.test.ts b/packages/eslint-plugin/tests/rules/method-signature-style.test.ts index d9db8f5d6eb..1fcd4f080fa 100644 --- a/packages/eslint-plugin/tests/rules/method-signature-style.test.ts +++ b/packages/eslint-plugin/tests/rules/method-signature-style.test.ts @@ -76,10 +76,10 @@ interface Test { interface Test { f(a: T): T } interface Test { ['f'](a: T, b: T): T } interface Test { 'f!'(/* b */ x: any /* c */): void } - type Test = { readonly f(a: string): number } + type Test = { f(a: string): number } type Test = { ['f']?(a: boolean): void } - type Test = { readonly f?(a?: T): T } - type Test = { readonly ['f']?(a: T, b: T): T } + type Test = { f?(a?: T): T } + type Test = { ['f']?(a: T, b: T): T } `, }), ...batchedSingleLineTests({ @@ -103,10 +103,10 @@ interface Test { interface Test { f(a: T): T } interface Test { ['f'](a: T, b: T): T } interface Test { 'f!'(/* b */ x: any /* c */): void } - type Test = { readonly f(a: string): number } + type Test = { f(a: string): number } type Test = { ['f']?(a: boolean): void } - type Test = { readonly f?(a?: T): T } - type Test = { readonly ['f']?(a: T, b: T): T } + type Test = { f?(a?: T): T } + type Test = { ['f']?(a: T, b: T): T } `, errors: [ { messageId: 'errorMethod', line: 2 }, @@ -125,10 +125,10 @@ interface Test { interface Test { f: (a: T) => T } interface Test { ['f']: (a: T, b: T) => T } interface Test { 'f!': (/* b */ x: any /* c */) => void } - type Test = { readonly f: (a: string) => number } + type Test = { f: (a: string) => number } type Test = { ['f']?: (a: boolean) => void } - type Test = { readonly f?: (a?: T) => T } - type Test = { readonly ['f']?: (a: T, b: T) => T } + type Test = { f?: (a?: T) => T } + type Test = { ['f']?: (a: T, b: T) => T } `, }), ...batchedSingleLineTests({ @@ -139,10 +139,10 @@ interface Test { interface Test { f: (a: T) => T } interface Test { ['f']: (a: T, b: T) => T } interface Test { 'f!': (/* b */ x: any /* c */) => void } - type Test = { readonly f: (a: string) => number } + type Test = { f: (a: string) => number } type Test = { ['f']?: (a: boolean) => void } - type Test = { readonly f?: (a?: T) => T } - type Test = { readonly ['f']?: (a: T, b: T) => T } + type Test = { f?: (a?: T) => T } + type Test = { ['f']?: (a: T, b: T) => T } `, errors: [ { messageId: 'errorProperty', line: 2 }, @@ -161,10 +161,10 @@ interface Test { interface Test { f(a: T): T } interface Test { ['f'](a: T, b: T): T } interface Test { 'f!'(/* b */ x: any /* c */): void } - type Test = { readonly f(a: string): number } + type Test = { f(a: string): number } type Test = { ['f']?(a: boolean): void } - type Test = { readonly f?(a?: T): T } - type Test = { readonly ['f']?(a: T, b: T): T } + type Test = { f?(a?: T): T } + type Test = { ['f']?(a: T, b: T): T } `, }), { diff --git a/packages/eslint-plugin/tests/rules/naming-convention/cases/method.test.ts b/packages/eslint-plugin/tests/rules/naming-convention/cases/method.test.ts index b4973f23297..ff78cf80dae 100644 --- a/packages/eslint-plugin/tests/rules/naming-convention/cases/method.test.ts +++ b/packages/eslint-plugin/tests/rules/naming-convention/cases/method.test.ts @@ -5,12 +5,11 @@ createTestCases([ code: [ 'class Ignored { private %() {} }', 'class Ignored { private "%"() {} }', - 'class Ignored { private readonly %() {} }', + 'class Ignored { private async %() {} }', 'class Ignored { private static %() {} }', - 'class Ignored { private static readonly %() {} }', + 'class Ignored { private static async %() {} }', 'class Ignored { private % = () => {} }', 'class Ignored { abstract %() }', - 'class Ignored { declare %() }', 'class Ignored { #%() }', 'class Ignored { static #%() }', ], diff --git a/packages/eslint-plugin/tests/rules/no-useless-constructor.test.ts b/packages/eslint-plugin/tests/rules/no-useless-constructor.test.ts index a8b0dd92e03..5301a2e930e 100644 --- a/packages/eslint-plugin/tests/rules/no-useless-constructor.test.ts +++ b/packages/eslint-plugin/tests/rules/no-useless-constructor.test.ts @@ -138,11 +138,6 @@ class A { ` abstract class A { constructor(); -} - `, - ` -abstract class A { - abstract constructor(); } `, // https://github.com/typescript-eslint/typescript-eslint/issues/48 diff --git a/packages/eslint-plugin/tests/rules/parameter-properties.test.ts b/packages/eslint-plugin/tests/rules/parameter-properties.test.ts index 44580ad1b92..237f277a31e 100644 --- a/packages/eslint-plugin/tests/rules/parameter-properties.test.ts +++ b/packages/eslint-plugin/tests/rules/parameter-properties.test.ts @@ -32,7 +32,7 @@ class Foo { `, ` class Foo { - constructor(name: string); + constructor(name: string) {} constructor(name: string, age?: number) {} } `, @@ -528,7 +528,7 @@ class Foo { { code: ` class Foo { - constructor(name: string); + constructor(name: string) {} constructor(private name: string, age?: number) {} } `, @@ -546,7 +546,7 @@ class Foo { { code: ` class Foo { - constructor(private name: string); + constructor(private name: string) {} constructor(private name: string, age?: number) {} } `, @@ -572,7 +572,7 @@ class Foo { { code: ` class Foo { - constructor(private name: string); + constructor(private name: string) {} constructor(private name: string, private age?: number) {} } `, @@ -606,7 +606,7 @@ class Foo { { code: ` class Foo { - constructor(name: string); + constructor(name: string) {} constructor(protected name: string, age?: number) {} } `, @@ -624,7 +624,7 @@ class Foo { { code: ` class Foo { - constructor(protected name: string); + constructor(protected name: string) {} constructor(protected name: string, age?: number) {} } `, @@ -650,7 +650,7 @@ class Foo { { code: ` class Foo { - constructor(protected name: string); + constructor(protected name: string) {} constructor(protected name: string, protected age?: number) {} } `, @@ -684,7 +684,7 @@ class Foo { { code: ` class Foo { - constructor(name: string); + constructor(name: string) {} constructor(public name: string, age?: number) {} } `, @@ -702,7 +702,7 @@ class Foo { { code: ` class Foo { - constructor(public name: string); + constructor(public name: string) {} constructor(public name: string, age?: number) {} } `, @@ -728,7 +728,7 @@ class Foo { { code: ` class Foo { - constructor(public name: string); + constructor(public name: string) {} constructor(public name: string, public age?: number) {} } `, @@ -894,7 +894,7 @@ class Foo { { code: ` class Foo { - constructor(private name: string); + constructor(private name: string) {} constructor(private name: string, protected age?: number) {} } `, diff --git a/packages/eslint-plugin/tests/rules/unified-signatures.test.ts b/packages/eslint-plugin/tests/rules/unified-signatures.test.ts index 9bd8a07e997..36304b3db5e 100644 --- a/packages/eslint-plugin/tests/rules/unified-signatures.test.ts +++ b/packages/eslint-plugin/tests/rules/unified-signatures.test.ts @@ -678,68 +678,6 @@ interface IFoo { }, ], }, - { - // Works with parameter properties. Note that this is invalid TypeScript syntax. - code: ` -class Foo { - constructor(readonly x: number); - constructor(readonly x: string); -} - `, - errors: [ - { - messageId: 'singleParameterDifference', - data: { - failureStringStart: - 'These overloads can be combined into one signature', - type1: 'number', - type2: 'string', - }, - line: 4, - column: 15, - }, - ], - }, - { - // Works with parameter properties. Note that this is invalid TypeScript syntax. - code: ` -class Foo { - constructor(readonly x: number); - constructor(readonly x: number, readonly y: string); -} - `, - errors: [ - { - messageId: 'omittingSingleParameter', - data: { - failureStringStart: - 'These overloads can be combined into one signature', - }, - line: 4, - column: 35, - }, - ], - }, - { - // Works with parameter properties. Note that this is invalid TypeScript syntax. - code: ` -class Foo { - constructor(readonly x: number); - constructor(readonly x: number, readonly y?: string, readonly z?: string); -} - `, - errors: [ - { - messageId: 'omittingSingleParameter', - data: { - failureStringStart: - 'These overloads can be combined into one signature', - }, - line: 4, - column: 56, - }, - ], - }, { code: ` export function foo(line: number): number; diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 660af4bb75c..6bf57f87287 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -9,11 +9,11 @@ import { createError, findNextToken, getBinaryExpressionType, + getContainingFunction, getDeclarationKind, getLastModifier, getLineAndCharacterFor, getLocFor, - getModifier, getRange, getTextForTokenKind, getTSNodeAccessibility, @@ -26,6 +26,7 @@ import { isOptional, isThisInTypeQuery, nodeHasIllegalDecorators, + nodeIsPresent, unescapeStringLiteralText, } from './node-utils'; import type { @@ -114,6 +115,8 @@ export class Converter { return null; } + this.#checkModifiers(node); + const pattern = this.allowPattern; if (allowPattern !== undefined) { this.allowPattern = allowPattern; @@ -623,14 +626,6 @@ export class Converter { | ts.GetAccessorDeclaration | ts.SetAccessorDeclaration, ): TSESTree.TSMethodSignature { - const exportKeyword = getModifier(SyntaxKind.ExportKeyword, node); - if (exportKeyword) { - this.#throwUnlessAllowInvalidAST( - exportKeyword, - 'A method signature cannot have an export modifier.', - ); - } - return this.createNode(node, { type: AST_NODE_TYPES.TSMethodSignature, accessibility: getTSNodeAccessibility(node), @@ -913,8 +908,6 @@ export class Converter { // Declarations case SyntaxKind.FunctionDeclaration: { - this.#checkIllegalDecorators(node); - const isDeclare = hasModifier(SyntaxKind.DeclareKeyword, node); const result = this.createNode< @@ -956,8 +949,6 @@ export class Converter { } case SyntaxKind.VariableStatement: { - this.#checkIllegalDecorators(node); - const result = this.createNode(node, { type: AST_NODE_TYPES.VariableDeclaration, declarations: node.declarationList.declarations.map(el => @@ -1661,14 +1652,6 @@ export class Converter { const modifiers = getModifiers(node); if (modifiers) { - const exportKeyword = getModifier(SyntaxKind.ExportKeyword, node); - if (exportKeyword) { - this.#throwUnlessAllowInvalidAST( - exportKeyword, - 'A parameter cannot have an export modifier.', - ); - } - return this.createNode(node, { type: AST_NODE_TYPES.TSParameterProperty, accessibility: getTSNodeAccessibility(node), @@ -2551,8 +2534,6 @@ export class Converter { return this.convertChild(node.expression, parent); case SyntaxKind.TypeAliasDeclaration: { - this.#checkIllegalDecorators(node); - const result = this.createNode(node, { type: AST_NODE_TYPES.TSTypeAliasDeclaration, declare: hasModifier(SyntaxKind.DeclareKeyword, node), @@ -2582,14 +2563,6 @@ export class Converter { ); } - const exportKeyword = getModifier(SyntaxKind.ExportKeyword, node); - if (exportKeyword) { - this.#throwUnlessAllowInvalidAST( - exportKeyword, - 'A property signature cannot have an export modifier.', - ); - } - return this.createNode(node, { type: AST_NODE_TYPES.TSPropertySignature, accessibility: getTSNodeAccessibility(node), @@ -2604,14 +2577,6 @@ export class Converter { } case SyntaxKind.IndexSignature: { - const exportKeyword = getModifier(SyntaxKind.ExportKeyword, node); - if (exportKeyword) { - this.#throwUnlessAllowInvalidAST( - exportKeyword, - 'An index signature cannot have an export modifier.', - ); - } - return this.createNode(node, { type: AST_NODE_TYPES.TSIndexSignature, accessibility: getTSNodeAccessibility(node), @@ -2706,8 +2671,6 @@ export class Converter { } case SyntaxKind.InterfaceDeclaration: { - this.#checkIllegalDecorators(node); - const interfaceHeritageClauses = node.heritageClauses ?? []; const interfaceExtends: TSESTree.TSInterfaceHeritage[] = []; @@ -2808,8 +2771,6 @@ export class Converter { } case SyntaxKind.EnumDeclaration: { - this.#checkIllegalDecorators(node); - const result = this.createNode(node, { type: AST_NODE_TYPES.TSEnumDeclaration, const: hasModifier(SyntaxKind.ConstKeyword, node), @@ -3134,13 +3095,196 @@ export class Converter { } } - #checkIllegalDecorators(node: ts.Node): void { + #checkModifiers(node: ts.Node): void { + if (this.options.allowInvalidAST) { + return; + } + if (nodeHasIllegalDecorators(node)) { - this.#throwUnlessAllowInvalidAST( + this.#throwError( node.illegalDecorators[0], 'Decorators are not valid here.', ); } + + for (const modifier of getModifiers(node) ?? []) { + if (modifier.kind !== SyntaxKind.ReadonlyKeyword) { + if ( + node.kind === SyntaxKind.PropertySignature || + node.kind === SyntaxKind.MethodSignature + ) { + this.#throwError( + modifier, + `'${ts.tokenToString( + modifier.kind, + )}' modifier cannot appear on a type member`, + ); + } + + if ( + node.kind === SyntaxKind.IndexSignature && + (modifier.kind !== SyntaxKind.StaticKeyword || + !ts.isClassLike(node.parent)) + ) { + this.#throwError( + modifier, + `'${ts.tokenToString( + modifier.kind, + )}' modifier cannot appear on an index signature`, + ); + } + } + + if ( + modifier.kind !== SyntaxKind.InKeyword && + modifier.kind !== SyntaxKind.OutKeyword && + modifier.kind !== SyntaxKind.ConstKeyword && + node.kind === SyntaxKind.TypeParameter + ) { + this.#throwError( + modifier, + `'${ts.tokenToString( + modifier.kind, + )}' modifier cannot appear on a type parameter`, + ); + } + + if ( + (modifier.kind === SyntaxKind.InKeyword || + modifier.kind === SyntaxKind.OutKeyword) && + (node.kind !== SyntaxKind.TypeParameter || + !( + ts.isInterfaceDeclaration(node.parent) || + ts.isClassLike(node.parent) || + ts.isTypeAliasDeclaration(node.parent) + )) + ) { + this.#throwError( + modifier, + `'${ts.tokenToString( + modifier.kind, + )}' modifier can only appear on a type parameter of a class, interface or type alias`, + ); + } + + if ( + modifier.kind === SyntaxKind.ReadonlyKeyword && + node.kind !== SyntaxKind.PropertyDeclaration && + node.kind !== SyntaxKind.PropertySignature && + node.kind !== SyntaxKind.IndexSignature && + node.kind !== SyntaxKind.Parameter + ) { + this.#throwError( + modifier, + "'readonly' modifier can only appear on a property declaration or index signature.", + ); + } + + if ( + modifier.kind === SyntaxKind.DeclareKeyword && + ts.isClassLike(node.parent) && + !ts.isPropertyDeclaration(node) + ) { + this.#throwError( + modifier, + `'${ts.tokenToString( + modifier.kind, + )}' modifier cannot appear on class elements of this kind.`, + ); + } + + if ( + modifier.kind === SyntaxKind.AbstractKeyword && + node.kind !== SyntaxKind.ClassDeclaration && + node.kind !== SyntaxKind.ConstructorType && + node.kind !== SyntaxKind.MethodDeclaration && + node.kind !== SyntaxKind.PropertyDeclaration && + node.kind !== SyntaxKind.GetAccessor && + node.kind !== SyntaxKind.SetAccessor + ) { + this.#throwError( + modifier, + `'${ts.tokenToString( + modifier.kind, + )}' modifier can only appear on a class, method, or property declaration.`, + ); + } + + if ( + (modifier.kind === SyntaxKind.StaticKeyword || + modifier.kind === SyntaxKind.PublicKeyword || + modifier.kind === SyntaxKind.ProtectedKeyword || + modifier.kind === SyntaxKind.PrivateKeyword) && + (node.parent.kind === SyntaxKind.ModuleBlock || + node.parent.kind === SyntaxKind.SourceFile) + ) { + this.#throwError( + modifier, + `'${ts.tokenToString( + modifier.kind, + )}' modifier cannot appear on a module or namespace element.`, + ); + } + + if ( + modifier.kind === SyntaxKind.AccessorKeyword && + node.kind !== SyntaxKind.PropertyDeclaration + ) { + this.#throwError( + modifier, + "'accessor' modifier can only appear on a property declaration.", + ); + } + + // `checkGrammarAsyncModifier` function in `typescript` + if ( + modifier.kind === SyntaxKind.AsyncKeyword && + node.kind !== SyntaxKind.MethodDeclaration && + node.kind !== SyntaxKind.FunctionDeclaration && + node.kind !== SyntaxKind.FunctionExpression && + node.kind !== SyntaxKind.ArrowFunction + ) { + this.#throwError(modifier, "'async' modifier cannot be used here."); + } + + // `checkGrammarModifiers` function in `typescript` + if ( + node.kind === SyntaxKind.Parameter && + (modifier.kind === SyntaxKind.StaticKeyword || + modifier.kind === SyntaxKind.ExportKeyword || + modifier.kind === SyntaxKind.DeclareKeyword || + modifier.kind === SyntaxKind.AsyncKeyword) + ) { + this.#throwError( + modifier, + `'${ts.tokenToString( + modifier.kind, + )}' modifier cannot appear on a parameter.`, + ); + } + + // `checkParameter` function in `typescript` + if ( + node.kind === SyntaxKind.Parameter && + // In `typescript` package, it's `ts.hasSyntacticModifier(node, ts.ModifierFlags.ParameterPropertyModifier)` + // https://github.com/typescript-eslint/typescript-eslint/pull/6615#discussion_r1136489935 + (modifier.kind === SyntaxKind.PublicKeyword || + modifier.kind === SyntaxKind.PrivateKeyword || + modifier.kind === SyntaxKind.ProtectedKeyword || + modifier.kind === SyntaxKind.ReadonlyKeyword) + ) { + const func = getContainingFunction(node)!; + + if ( + !(func.kind === SyntaxKind.Constructor && nodeIsPresent(func.body)) + ) { + this.#throwError( + modifier, + 'A parameter property is only allowed in a constructor implementation.', + ); + } + } + } } #throwUnlessAllowInvalidAST( diff --git a/packages/typescript-estree/src/node-utils.ts b/packages/typescript-estree/src/node-utils.ts index 8efe2730678..b7f06546135 100644 --- a/packages/typescript-estree/src/node-utils.ts +++ b/packages/typescript-estree/src/node-utils.ts @@ -90,21 +90,6 @@ export function hasModifier( return modifiers?.some(modifier => modifier.kind === modifierKind) === true; } -/** - * Get a modifier from a ts.Node - * @param modifierKind TypeScript SyntaxKind modifier - * @param node TypeScript AST node - * @returns matched modifier if present or null - */ -export function getModifier( - modifierKind: ts.KeywordSyntaxKind, - node: ts.Node, -): ts.Modifier | null { - return ( - getModifiers(node)?.find(modifier => modifier.kind === modifierKind) ?? null - ); -} - /** * Get last last modifier in ast * @param node TypeScript AST node @@ -757,3 +742,27 @@ export function isThisInTypeQuery(node: ts.Node): boolean { return node.parent.kind === SyntaxKind.TypeQuery; } + +// `ts.nodeIsMissing` +function nodeIsMissing(node: ts.Node | undefined): boolean { + if (node === undefined) { + return true; + } + return ( + node.pos === node.end && + node.pos >= 0 && + node.kind !== SyntaxKind.EndOfFileToken + ); +} + +// `ts.nodeIsPresent` +export function nodeIsPresent(node: ts.Node | undefined): node is ts.Node { + return !nodeIsMissing(node); +} + +// `ts.getContainingFunction` +export function getContainingFunction( + node: ts.Node, +): ts.SignatureDeclaration | undefined { + return ts.findAncestor(node.parent, ts.isFunctionLike); +}